You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A mapped type is a generic type which uses a union of `PropertyKey`s (frequently created [via a `keyof`](/docs/handbook/2/indexed-access-types.html)) to iterate through keys to create a type:
25
+
매핑된 타입은 `PropertyKey`([`keyof`을 통해서](/docs/handbook/2/indexed-access-types.html) 자주 생성되는)의 조합을 사용하여 키를 통해 타입을 반복적으로 생성하는 제너릭 타입입니다.
26
26
27
27
```ts twoslash
28
28
typeOptionsFlags<Type> = {
29
29
[PropertyinkeyofType]:boolean;
30
30
};
31
31
```
32
32
33
-
In this example, `OptionsFlags` will take all the properties from the type `Type`and change their values to be a boolean.
33
+
다음 예제에서, `OptionsFlags`는 `Type`타입의 모든 프로퍼티를 가져와서 해당 값을 불린으로 변경합니다.
34
34
35
35
```ts twoslash
36
36
typeOptionsFlags<Type> = {
@@ -48,12 +48,12 @@ type FeatureOptions = OptionsFlags<FeatureFlags>;
48
48
49
49
### Mapping Modifiers
50
50
51
-
There are two additional modifiers which can be applied during mapping: `readonly` and `?`which affect mutability and optionality respectively.
51
+
매핑중에는 추가할 수 있는 수정자로 `readonly`와 `?`있습니다. 각각 가변성과 선택성에 영향을 미칩니다.
52
52
53
-
You can remove or add these modifiers by prefixing with `-`or`+`. If you don't add a prefix, then `+` is assumed.
53
+
`-`또는`+`를 접두사로 붙여서 이런 수정자를 추가하거나 제거할 수 있습니다. 접두사를 추가하지 않으면 `+`로 간주합니다.
54
54
55
55
```ts twoslash
56
-
//Removes 'readonly' attributes from a type's properties
56
+
//타입의 프로퍼티에서 'readonly' 속성을 제거합니다
57
57
typeCreateMutable<Type> = {
58
58
-readonly [PropertyinkeyofType]:Type[Property];
59
59
};
@@ -68,7 +68,7 @@ type UnlockedAccount = CreateMutable<LockedAccount>;
68
68
```
69
69
70
70
```ts twoslash
71
-
//Removes 'optional' attributes from a type's properties
71
+
//타입의 프로퍼티에서 'optional' 속성을 제거합니다
72
72
typeConcrete<Type> = {
73
73
[PropertyinkeyofType]-?:Type[Property];
74
74
};
@@ -85,15 +85,15 @@ type User = Concrete<MaybeUser>;
85
85
86
86
## Key Remapping via `as`
87
87
88
-
In TypeScript 4.1 and onwards, you can re-map keys in mapped types with an `as` clause in a mapped type:
88
+
TypeScript 4.1 이상에서는 매핑된 타입에 `as` 절을 사용해서 매핑된 타입의 키를 다시 매핑할 수 있습니다.
@@ -143,7 +143,7 @@ type Config = EventConfig<SquareEvent | CircleEvent>
143
143
144
144
### Further Exploration
145
145
146
-
Mapped types work well with other features in this type manipulation section, for example here is [a mapped type using a conditional type](/docs/handbook/2/conditional-types.html) which returns either a `true` or `false` depending on whether an object has the property `pii` set to the literal `true`:
146
+
매핑된 타입은 타입 조작 섹션의 다른 기능들과 잘 동작합니다. 예를 들어 객체의 `pii` 프로퍼티가 `true`로 설정되어 있는지에 따라 `true` 혹은 `false`를 반환하는 [조건부 타입을 사용한 매핑된 타입](/docs/handbook/2/conditional-types.html)이 있습니다.
0 commit comments