Skip to content

Commit 1773560

Browse files
Merge pull request #1449 from yahma25/translation-ko_201228
Translation 2 file to Ko
2 parents 1e7ea49 + c988635 commit 1773560

2 files changed

Lines changed: 89 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// # Nullish Coalescing
2+
//
3+
// `??`는 `||`의 일반적인 사용 방법을 보완하는 새로운 연산자입니다.
4+
// `===`가 `==`의 사용을 더 엄격한 등호 형태로
5+
// 보완하는 방식과 같습니다.
6+
//
7+
// 연산자를 이해하기 위해 어떻게 ||가 동작하는지 봅시다:
8+
9+
const response = {
10+
nullValue: null,
11+
headerText: "",
12+
animationDuration: 0,
13+
height: 400,
14+
showSplashScreen: false,
15+
} as const;
16+
17+
const undefinedValue = response.undefinedValue || "some other default";
18+
// 결과는 이렇게 됩니다: 'some other default'
19+
20+
const nullValue = response.nullValue || "some other default";
21+
22+
// 2개의 예시는 대부분 언어에서 비슷하게 동작합니다.
23+
// 하나의 도구로써 || 연산자는 기본값을 설정할 때 매우 적합하지만,
24+
// JavaScript falsy 체크는 몇 가지 일반적인 값으로 여러분을 당황하게 할 수 있습니다:
25+
26+
// 의도와 다를 수 있습니다. ''은 falsy고, 결과는 다음과 같습니다: 'Hello, world!'
27+
const headerText = response.headerText || "Hello, world!";
28+
29+
// 의도와 다를 수 있습니다. 0은 falsy고, 결과는 다음과 같습니다: 300
30+
const animationDuration = response.animationDuration || 300;
31+
32+
// 의도와 다를 수 있습니다. false는 falsy고, 결과는 다음과 같습니다: true
33+
const showSplashScreen = response.showSplashScreen || true;
34+
35+
// 대신 ??으로 전환하여 사용한다면,
36+
// === 등호는 양쪽을 비교하기 위해 사용됩니다:
37+
38+
const emptyHeaderText = response.headerText ?? "Hello, world!";
39+
const zeroAnimationDuration = response.animationDuration ?? 300;
40+
const skipSplashScreen = response.showSplashScreen ?? true;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//// { compiler: { ts: "4.0.2" } }
2+
// 튜플은 타입 시스템에서 순서가 중요한 배열입니다,
3+
// 여러분은 예시에서 자세히 배울 수 있습니다: 튜플
4+
5+
// TypeScript 4.0에서, 튜플의 얻게 된 기능의 타입은
6+
// 배열의 각각 다른 부분에 이름을 부여할 수 있습니다.
7+
8+
// 예를 들어, 여러분은 Lat, Long 위치를 튜플을 통해 작성하곤 했습니다:
9+
10+
type OldLocation = [number, number]
11+
12+
const locations: OldLocation[] = [
13+
[40.7144, -74.006],
14+
[53.6458, -1.785]
15+
]
16+
17+
// 어떤 것이 Latitude이고 Longitude인지 아는 것은 모호하므로,
18+
// 여러분은 LatLong 튜플이라고 불러왔을 겁니다.
19+
20+
// 4.0에서는, 이렇게 작성할 수 있습니다.
21+
22+
type NewLocation = [lat: number, long: number]
23+
24+
const newLocations: NewLocation[] = [
25+
[52.3702, 4.8952],
26+
[53.3498, -6.2603]
27+
]
28+
29+
// 그 이름은 이제 에디터에서
30+
// 여러분이 다음 줄의 끝에 있는 0과 1 위에서 호버할 때 보입니다.
31+
const firstLat = newLocations[0][0]
32+
const firstLong = newLocations[0][1]
33+
34+
// 조금 실망스럽게 보일 수 있지만,
35+
// 주요 목표는 타입 시스템이 동작할 때,
36+
// 정보를 잃어버리지 않도록 하는 것입니다.
37+
// 예를 들어, Parameter 유틸리티 타입을 사용하는 함수에서
38+
// 파라미터를 추출할 경우:
39+
40+
function centerMap(lng: number, lat: number) {}
41+
42+
// 4.0에서, lng와 lat는 유지합니다
43+
type CenterMapParams = Parameters<typeof centerMap>
44+
45+
// 3.9에서는, 이렇게 보입니다
46+
type OldCenterMapParams = [number, number]
47+
48+
// 파라미터 정보에 대해
49+
// 더 복잡한 타입 조작 손실을 만듭니다.

0 commit comments

Comments
 (0)