forked from pagers-org/Effective-TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02.ts
More file actions
34 lines (31 loc) ยท 798 Bytes
/
02.ts
File metadata and controls
34 lines (31 loc) ยท 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* ๋ฌธ์ 2
* ์์ PapagoParamsSource์ PapagoParamsTarget ๋ฅผ ์กฐํฉํ์ฌ ๋ช
์ธ์์ ์ธ๊ธํ๋
* "๋ฒ์ญํ ์ ์๋ ์๋ณธ ์ธ์ด์ ๋ชฉ์ ์ธ์ด๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค." ์ ์ ์ฝ์กฐ๊ฑด์ ์ฐธ๊ณ ํ์ฌ PapagoParams ์ธํฐํ์ด์ค๋ฅผ ๊ฐ์ ํด ์ฃผ์ธ์.
* */
interface KoParams {
source: 'ko';
target: SupportedLanguague;
text: string;
}
interface EnParams {
source: 'en';
target: 'ja'|'fr'|'zh-CN'|'zh-TW'|'ko';
text: string;
}
interface JaParams {
source: 'ja';
target: 'zh-CN' | 'zh-TW' | 'ko';
text: string;
}
interface ZhCnParams {
source: 'zh-Cn';
target: 'zh-TW';
text: string;
}
type PapagoParams = KoParams | EnParams | JaParams | ZhCnParams;
const params: PapagoParams= {
source: 'en',
target: 'ja',
text: 'Hello Typescript!'
}