Skip to content

Commit 6d6c10e

Browse files
Merge pull request #188 from jaryapp/ts-4.9-ko-satisfies
Co-authored-by: bumkeyy <bumkeyy@users.noreply.github.com>
2 parents 5c6b886 + 9cdbe62 commit 6d6c10e

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

docs/documentation/ko/release-notes/TypeScript 4.9.md

+26-26
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@ permalink: /ko/docs/handbook/release-notes/typescript-4-9.html
55
oneline: TypeScript 4.9 릴리즈 노트
66
---
77

8-
## The `satisfies` Operator
8+
## `satisfies` 연산자
99

10-
TypeScript developers are often faced with a dilemma: we want to ensure that some expression *matches* some type, but also want to keep the *most specific* type of that expression for inference purposes.
10+
TypeScript 개발자들은 종종 딜레마에 직면합니다. 우리는 일부 표현식이 타입과 *일치*하는지 확인하고 싶지만, 추론을 위해 표현식의 *가장 구체적인 타입*을 유지하고 싶을 때가 있습니다.
1111

12-
For example:
12+
예를 들어
1313

1414
```ts
15-
// Each property can be a string or an RGB tuple.
15+
// 각 속성은 문자열 또는 RGB 튜플일 수 있습니다.
1616
const palette = {
1717
red: [255, 0, 0],
1818
green: "#00ff00",
1919
bleu: [0, 0, 255]
20-
// ^^^^ sacrebleu - we've made a typo!
20+
// ^^^^ sacrebleu - 오타를 냈습니다!
2121
};
2222

23-
// We want to be able to use array methods on 'red'...
23+
// 우리는 배열 메서드를 'red'에 사용하고 싶습니다...
2424
const redComponent = palette.red.at(0);
2525

26-
// or string methods on 'green'...
26+
// 혹은 'green'에 문자열 메서드를 사용하고 싶을 수 있습니다...
2727
const greenNormalized = palette.green.toUpperCase();
2828
```
2929

30-
Notice that we've written `bleu`, whereas we probably should have written `blue`.
31-
We could try to catch that `bleu` typo by using a type annotation on `palette`, but we'd lose the information about each property.
30+
우리는 `bleu` 대신, `blue`를 썼어야 했습니다.
31+
`palette`에 타입을 표기해서 `bleu` 오타를 잡을 수도 있지만, 그렇게 되면 각 속성에 대한 정보를 잃게 됩니다.
3232

3333
```ts
3434
type Colors = "red" | "green" | "blue";
@@ -39,15 +39,15 @@ const palette: Record<Colors, string | RGB> = {
3939
red: [255, 0, 0],
4040
green: "#00ff00",
4141
bleu: [0, 0, 255]
42-
// ~~~~ The typo is now correctly detected
42+
// ~~~~ 이제 오타를 올바르게 감지했습니다.
4343
};
4444

45-
// But we now have an undesirable error here - 'palette.red' "could" be a string.
45+
// 하지만 여기서 원치 않는 문제가 발생했습니다. 'palette.red'가 문자열이 "될 수 있다"는것 입니다.
4646
const redComponent = palette.red.at(0);
4747
```
4848

49-
The new `satisfies` operator lets us validate that the type of an expression matches some type, without changing the resulting type of that expression.
50-
As an example, we could use `satisfies` to validate that all the properties of `palette` are compatible with `string | number[]`:
49+
`satisfies` 연산자를 사용하면 표현식의 결과 타입을 변경하지 않고 표현식의 타입이 특정 타입과 일치하는지 검증할 수 있습니다.
50+
예를 들어, 우리는 `satisfies`를 사용하여 `palette`의 모든 속성이 `string | number[]`와 호환되는지 검증할 수 있습니다.
5151

5252
```ts
5353
type Colors = "red" | "green" | "blue";
@@ -58,35 +58,35 @@ const palette = {
5858
red: [255, 0, 0],
5959
green: "#00ff00",
6060
bleu: [0, 0, 255]
61-
// ~~~~ The typo is now caught!
61+
// ~~~~ 오타가 잡혔습니다!
6262
} satisfies Record<Colors, string | RGB>;
6363

64-
// Both of these methods are still accessible!
64+
// 두 메서드 모두 여전히 접근할 수 있습니다!
6565
const redComponent = palette.red.at(0);
6666
const greenNormalized = palette.green.toUpperCase();
6767
```
6868

69-
`satisfies` can be used to catch lots of possible errors.
70-
For example, we could ensure that an object has *all* the keys of some type, but no more:
69+
`satisfies`는 많은 오류를 탐지하는데 사용할 수 있습니다.
70+
예를 들면, 객체가 특정 타입의 *모든* 키를 가지지만, 그 이상은 가지지 않도록 할 수 있습니다.
7171

7272
```ts
7373
type Colors = "red" | "green" | "blue";
7474

75-
// Ensure that we have exactly the keys from 'Colors'.
75+
// 'Colors' 키가 정확한지 확인합니다.
7676
const favoriteColors = {
7777
"red": "yes",
7878
"green": false,
7979
"blue": "kinda",
8080
"platypus": false
81-
// ~~~~~~~~~~ error - "platypus" was never listed in 'Colors'.
81+
// ~~~~~~~~~~ 에러 - "platypus"'Colors' 리스트에 없습니다.
8282
} satisfies Record<Colors, unknown>;
8383

84-
// All the information about the 'red', 'green', and 'blue' properties are retained.
84+
// 'red', 'green' 'blue' 속성의 모든 정보가 유지됩니다.
8585
const g: boolean = favoriteColors.green;
8686
```
8787

88-
Maybe we don't care about if the property names match up somehow, but we do care about the types of each property.
89-
In that case, we can also ensure that all of an object's property values conform to some type.
88+
이따금 우리는 속성 이름 일치 여부보다 각 속성의 타입에 관심이 있을 수 있습니다.
89+
이 경우 개체의 모든 속성 값이 일부 타입을 준수하는지 확인할 수도 있습니다.
9090

9191
```ts
9292
type RGB = [red: number, green: number, blue: number];
@@ -95,16 +95,16 @@ const palette = {
9595
red: [255, 0, 0],
9696
green: "#00ff00",
9797
blue: [0, 0]
98-
// ~~~~~~ error!
98+
// ~~~~~~ 에러!
9999
} satisfies Record<string, string | RGB>;
100100

101-
// Information about each property is still maintained.
101+
// 각 속성에 대한 정보는 계속 유지됩니다.
102102
const redComponent = palette.red.at(0);
103103
const greenNormalized = palette.green.toUpperCase();
104104
```
105105

106-
For more examples, you can see the [issue proposing this](https://github.com/microsoft/TypeScript/issues/47920) and [the implementing pull request](https://github.com/microsoft/TypeScript/pull/46827).
107-
We'd like to thank [Oleksandr Tarasiuk](https://github.com/a-tarasyuk) who implemented and iterated on this feature with us.
106+
더 많은 예시를 보고 싶다면, [제안한 이슈](https://github.com/microsoft/TypeScript/issues/47920) [이를 구현한 pull request](https://github.com/microsoft/TypeScript/pull/46827)를 확인하세요.
107+
우리와 함께 이 기능을 구현한 [Oleksandr Tarasiuk](https://github.com/a-tarasyuk)에게 감사드립니다.
108108

109109
## Unlisted Property Narrowing with the `in` Operator
110110

0 commit comments

Comments
 (0)