|
1 | 1 | ```ts |
2 | | -// Type definitions for [~THE LIBRARY NAME~] [~OPTIONAL VERSION NUMBER~] |
3 | | -// Project: [~THE PROJECT NAME~] |
4 | | -// Definitions by: [~YOUR NAME~] <[~A URL FOR YOU~]> |
| 2 | +// Type definitions for [~라이브러리 이름~] [~선택적 버전 숫자~] |
| 3 | +// Project: [~프로젝트 이름~] |
| 4 | +// Definitions by: [~내 이름~] <[~내 URL~]> |
5 | 5 |
|
6 | | -/*~ If this library is callable (e.g. can be invoked as myLib(3)), |
7 | | - *~ include those call signatures here. |
8 | | - *~ Otherwise, delete this section. |
| 6 | +/*~ 라이브러리가 호출 가능하다면 (예. myLib(3)처럼 호출 가능하다면) |
| 7 | + *~ 여기에 호출 시그니처를 포함하세요. |
| 8 | + *~ 그렇지 않으면, 이 섹션은 삭제하세요. |
9 | 9 | */ |
10 | 10 | declare function myLib(a: string): string; |
11 | 11 | declare function myLib(a: number): number; |
12 | 12 |
|
13 | | -/*~ If you want the name of this library to be a valid type name, |
14 | | - *~ you can do so here. |
| 13 | +/*~ 라이브러리의 이름이 유효한 타입 이름으로 사용하고 싶으면, |
| 14 | + *~ 여기서 할 수 있습니다. |
15 | 15 | *~ |
16 | | - *~ For example, this allows us to write 'var x: myLib'; |
17 | | - *~ Be sure this actually makes sense! If it doesn't, just |
18 | | - *~ delete this declaration and add types inside the namespace below. |
| 16 | + *~ 예를 들어, 'var x: myLib'; 처럼 사용할 수 있습니다. |
| 17 | + *~ 하지만 이게 실제로 의미 있는지 확인하세요! 그렇지 않다면, |
| 18 | + *~ 해당 선언을 삭제하고 아래 네임스페이스 안에 타입을 추가하세요. |
19 | 19 | */ |
20 | 20 | interface myLib { |
21 | 21 | name: string; |
22 | 22 | length: number; |
23 | 23 | extras?: string[]; |
24 | 24 | } |
25 | 25 |
|
26 | | -/*~ If your library has properties exposed on a global variable, |
27 | | - *~ place them here. |
28 | | - *~ You should also place types (interfaces and type alias) here. |
| 26 | +/*~ 전역 변수에 export된 프로퍼티를 라이브러리가 갖고 있다면, |
| 27 | + *~ 이곳에 위치시키세요. |
| 28 | + *~ 여기에도 타입 (인터페이스와 타입 별칭)을 위치시켜야 합니다. |
29 | 29 | */ |
30 | 30 | declare namespace myLib { |
31 | | - //~ We can write 'myLib.timeout = 50;' |
| 31 | + //~ 'myLib.timeout = 50;' 라고 사용할 수 있습니다. |
32 | 32 | let timeout: number; |
33 | 33 |
|
34 | | - //~ We can access 'myLib.version', but not change it |
| 34 | + //~ 'myLib.version'에 접근할 수 있지만, 수정할 순 없습니다. |
35 | 35 | const version: string; |
36 | 36 |
|
37 | | - //~ There's some class we can create via 'let c = new myLib.Cat(42)' |
38 | | - //~ Or reference e.g. 'function f(c: myLib.Cat) { ... } |
| 37 | + //~ 'let c = new myLib.Cat(42)' 또는 참조 (예. 'function f(c: myLib.Cat) { ... }) 를 통해 |
| 38 | + //~ 클래스를 만들 수 있습니다 |
39 | 39 | class Cat { |
40 | 40 | constructor(n: number); |
41 | 41 |
|
42 | | - //~ We can read 'c.age' from a 'Cat' instance |
| 42 | + //~ 'Cat' 인스턴스에서 'c.age'를 읽을 수 있습니다 |
43 | 43 | readonly age: number; |
44 | 44 |
|
45 | | - //~ We can invoke 'c.purr()' from a 'Cat' instance |
| 45 | + //~ 'Cat' 인스턴스에서 'c.purr()'를 호출할 수 있습니다. |
46 | 46 | purr(): void; |
47 | 47 | } |
48 | 48 |
|
49 | | - //~ We can declare a variable as |
| 49 | + //~ 다음과 같이 변수를 선언할 수 있습니다. |
50 | 50 | //~ 'var s: myLib.CatSettings = { weight: 5, name: "Maru" };' |
51 | 51 | interface CatSettings { |
52 | 52 | weight: number; |
53 | 53 | name: string; |
54 | 54 | tailLength?: number; |
55 | 55 | } |
56 | 56 |
|
57 | | - //~ We can write 'const v: myLib.VetID = 42;' |
58 | | - //~ or 'const v: myLib.VetID = "bob";' |
| 57 | + //~ 'const v: myLib.VetID = 42;'라고 작성할 수 있습니다. |
| 58 | + //~ 또는 'const v: myLib.VetID = "bob";' |
59 | 59 | type VetID = string | number; |
60 | 60 |
|
61 | | - //~ We can invoke 'myLib.checkCat(c)' or 'myLib.checkCat(c, v);' |
| 61 | + //~ 'myLib.checkCat(c)' 나 'myLib.checkCat(c, v);'을 호출할 수 있습니다. |
62 | 62 | function checkCat(c: Cat, s?: VetID); |
63 | 63 | } |
64 | | -``` |
| 64 | +``` |
0 commit comments