@@ -223,15 +223,15 @@ function networkStatus(state: NetworkState): string {
223
223
}
224
224
```
225
225
226
- # Intersection Types
226
+ # ๊ต์ฐจ ํ์
( Intersection Types)
227
227
228
- Intersection types are closely related to union types, but they are used very differently .
229
- An intersection type combines multiple types into one .
230
- This allows you to add together existing types to get a single type that has all the features you need .
231
- For example , ` Person & Serializable & Loggable ` is a type which is all of ` Person ` _ and _ ` Serializable ` _ and _ ` Loggable ` .
232
- That means an object of this type will have all members of all three types .
228
+ ๊ต์ฐจ ํ์
์ ์ ๋์ธ ํ์
๊ณผ ๋ฐ์ ํ ๊ด๋ จ์ด ์์ง๋ง, ์ฌ์ฉ ๋ฐฉ๋ฒ์ ๋งค์ฐ ๋ค๋ฆ
๋๋ค .
229
+ ๊ต์ฐจ ํ์
์ ์ฌ๋ฌ ํ์
์ ํ๋๋ก ๊ฒฐํฉํฉ๋๋ค .
230
+ ๊ธฐ์กด ํ์
์ ํฉ์ณ ํ์ํ ๊ธฐ๋ฅ์ ๋ชจ๋ ๊ฐ์ง ๋จ์ผ ํ์
์ ์ป์ ์ ์์ต๋๋ค .
231
+ ์๋ฅผ ๋ค์ด , ` Person & Serializable & Loggable ` ์ ` Person ` _ ๊ณผ _ ` Serializable ` _ ๊ทธ๋ฆฌ๊ณ _ ` Loggable ` ์
๋๋ค .
232
+ ์ฆ, ์ด ํ์
์ ๊ฐ์ฒด๋ ์ธ ๊ฐ์ง ํ์
์ ๋ชจ๋ ๋ฉค๋ฒ๋ฅผ ๊ฐ๊ฒ ๋ฉ๋๋ค .
233
233
234
- For example, if you had networking requests with consistent error handling then you could separate out the error handling into it's own type which is merged with types which correspond to a single response type .
234
+ ์๋ฅผ ๋ค์ด, ์ผ๊ด๋ ์๋ฌ๋ฅผ ๋ค๋ฃจ๋ ์ฌ๋ฌ ๋คํธ์ํฌ ์์ฒญ์ด ์๋ค๋ฉด ํด๋น ์๋ฌ ํธ๋ค๋ง์ ๋ถ๋ฆฌํ์ฌ ํ๋์ ์๋ต ํ์
์ ๋์ํ๋ ๊ฒฐํฉ๋ ์์ฒด ํ์
์ผ๋ก ๋ง๋ค ์ ์์ต๋๋ค .
235
235
236
236
``` ts
237
237
interface ErrorHandling {
@@ -247,8 +247,8 @@ interface ArtistsData {
247
247
artists: { name: string }[];
248
248
}
249
249
250
- // These interfaces are composed to have
251
- // consistent error handling, and their own data .
250
+ // ์ด ์ธํฐํ์ด์ค๋ค์
251
+ // ํ๋์ ์๋ฌ ํธ๋ค๋ง๊ณผ ์์ฒด ๋ฐ์ดํฐ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค .
252
252
253
253
type ArtworksResponse = ArtworksData & ErrorHandling ;
254
254
type ArtistsResponse = ArtistsData & ErrorHandling ;
@@ -263,9 +263,9 @@ const handleArtistsResponse = (response: ArtistsResponse) => {
263
263
};
264
264
```
265
265
266
- ## Mixins via Intersections
266
+ ## ๊ต์ฐจ๋ฅผ ํตํ ๋ฏน์ค์ธ ( Mixins via Intersections)
267
267
268
- Intersections are used to implement the [ mixin pattern ] ( /docs/handbook/mixins.html ) :
268
+ ๊ต์ฐจ๋ [ ๋ฏน์ค์ธ ํจํด ] ( /docs/handbook/mixins.html ) ์ ์คํํ๊ธฐ ์ํด ์ฌ์ฉ๋ฉ๋๋ค.
269
269
270
270
``` ts
271
271
class Person {
@@ -282,7 +282,7 @@ class ConsoleLogger implements Loggable {
282
282
}
283
283
}
284
284
285
- // Takes two objects and merges them together
285
+ // ๋ ๊ฐ์ฒด๋ฅผ ๋ฐ์ ํ๋๋ก ํฉ์นฉ๋๋ค.
286
286
function extend<First extends {}, Second extends {}>(
287
287
first : First ,
288
288
second : Second
0 commit comments