From d67187952f8bec9e724ba4b6f34cefefc7ea1651 Mon Sep 17 00:00:00 2001 From: yahma25 Date: Sun, 4 Jul 2021 12:11:15 +0900 Subject: [PATCH 01/12] Translate 1 file to ko, playground - Variadic Tuples --- .../ko/4-0/New TS Features/Variadic Tuples.ts | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts new file mode 100644 index 00000000..89a52d29 --- /dev/null +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -0,0 +1,53 @@ +//// { compiler: { ts: "4.0.2" } } +// 가변 튜플은 제네릭처럼 동작하는 방식으로 타입 검사기를 통해 +// 타입을 전달하기 위하여 나머지 연산자(...)를 처리하는 기능을 튜플에게 제공합니다. + +// 꽤 고급 주제라서 이해하기 어렵더라도 너무 걱정하지 마세요. +// example:generic-functions 그리고 example:tuples를 기반으로 합니다. + +// 시작해보기 위해, 숫자를 가진 다른 튜플을 +// 항상 앞에 붙이는 가변 튜플이 있습니다: + +type AddMax = [max: number, ...rest: T]; +// ^ T를 제한하기 위해 사용한 제네릭 +// ^ 어디에 병합하는지 나타내기 위해 사용한 ... + +// 구성을 위해 사용 할 수 있습니다: +type MaxMin = AddMax<[min: number]> +type MaxMinDiameter = AddMax<[min: number, diameter: number]> + +// 튜플 이후에도 똑같이 사용 할 수 있습니다: +type SuffixDIContext = [...first: T, context: any]; +type DIContainer = SuffixDIContext<[param: string]> + +// 이 메커니즘은 여러 개의 입력 매개변수와 합칠 수 있습니다. +// 예를 들어, 이 함수는 두 개의 배열을 병합하지만 +// 배열이 시작, 중단하는 곳을 나타내기 위해 '\0' 기호를 사용합니다. +function joinWithNullTerminators(t: [...T], u: [...U]) { + return ['\0', ...t, '\0', ...u, '\0'] as const; +} + +// TypeScript는 다음과 같이 함수의 반환 타입을 추론할 수 있습니다: +const result = joinWithNullTerminators(['variadic', 'types'], ["terminators", 3]); + +// 이런 도구를 사용하여 함수형 프로그래밍에서 잘 적용된 개념인 +// curry 함수처럼 올바르게 입력 할 수 있습니다: + +function curry(f: (...args: [...T, ...U]) => R, ...a: T) { + return (...b: U) => f(...a, ...b); +} + +// 세 가지 제네릭 인수가 있습니다: +// - T: curry 함수에 입력 배열인 매개변수 +// - U: curry 함수에 _전달되지 않고_ 반환 함수에 적용하기 위해 필요한 매개변수 +// - R: 함수에 전달한 반환 타입 + +const sum = (left: number, right: number,) => left + right + +const a = curry(sum, 1, 2) +const b = curry(sum, 1)(2) +const c = curry(sum)(1, 2) + +// 여기에서 더 많은 코드 예시와 함께 더 상세한 설명을 찾아볼 수 있습니다 +// https://github.com/microsoft/TypeScript/pull/39094 + From 727cfe4d3ae169d9ada7da3a088ee9bd0274aa2a Mon Sep 17 00:00:00 2001 From: MyoungHo Kim <34343507+yahma25@users.noreply.github.com> Date: Mon, 3 Jan 2022 20:44:17 +0900 Subject: [PATCH 02/12] Update docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts Co-authored-by: Kibeom Kwon --- docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts index 89a52d29..d788f799 100644 --- a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -1,5 +1,5 @@ //// { compiler: { ts: "4.0.2" } } -// 가변 튜플은 제네릭처럼 동작하는 방식으로 타입 검사기를 통해 +// 가변 튜플은 제네릭이 동작하는 방식처럼 타입을 타입 검사기에 전달하기 위해 // 타입을 전달하기 위하여 나머지 연산자(...)를 처리하는 기능을 튜플에게 제공합니다. // 꽤 고급 주제라서 이해하기 어렵더라도 너무 걱정하지 마세요. From f0181f38dcd229d7cc0f479ef3a2cb98f948711f Mon Sep 17 00:00:00 2001 From: MyoungHo Kim <34343507+yahma25@users.noreply.github.com> Date: Mon, 3 Jan 2022 20:44:30 +0900 Subject: [PATCH 03/12] Update docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts Co-authored-by: Kibeom Kwon --- docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts index d788f799..54259db8 100644 --- a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -1,6 +1,6 @@ //// { compiler: { ts: "4.0.2" } } // 가변 튜플은 제네릭이 동작하는 방식처럼 타입을 타입 검사기에 전달하기 위해 -// 타입을 전달하기 위하여 나머지 연산자(...)를 처리하는 기능을 튜플에게 제공합니다. +// 나머지 연산자(...)를 처리하는 기능을 튜플에게 제공합니다. // 꽤 고급 주제라서 이해하기 어렵더라도 너무 걱정하지 마세요. // example:generic-functions 그리고 example:tuples를 기반으로 합니다. From 496d4bfa253c3f810daa76f273d94e6b7959dcc1 Mon Sep 17 00:00:00 2001 From: MyoungHo Kim <34343507+yahma25@users.noreply.github.com> Date: Mon, 3 Jan 2022 20:45:43 +0900 Subject: [PATCH 04/12] Update docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts Co-authored-by: Kibeom Kwon --- docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts index 54259db8..3c5fa6c5 100644 --- a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -5,7 +5,7 @@ // 꽤 고급 주제라서 이해하기 어렵더라도 너무 걱정하지 마세요. // example:generic-functions 그리고 example:tuples를 기반으로 합니다. -// 시작해보기 위해, 숫자를 가진 다른 튜플을 +// 먼저 튜플 앞에 항상 숫자를 붙이는 // 항상 앞에 붙이는 가변 튜플이 있습니다: type AddMax = [max: number, ...rest: T]; From 4dd3872a448e76a6550a8ab5b76be122bd746add Mon Sep 17 00:00:00 2001 From: MyoungHo Kim <34343507+yahma25@users.noreply.github.com> Date: Mon, 3 Jan 2022 20:48:37 +0900 Subject: [PATCH 05/12] Update docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts Co-authored-by: Kibeom Kwon --- docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts index 3c5fa6c5..80c31870 100644 --- a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -12,7 +12,7 @@ type AddMax = [max: number, ...rest: T]; // ^ T를 제한하기 위해 사용한 제네릭 // ^ 어디에 병합하는지 나타내기 위해 사용한 ... -// 구성을 위해 사용 할 수 있습니다: +// 합성할 때 사용 할 수 있습니다: type MaxMin = AddMax<[min: number]> type MaxMinDiameter = AddMax<[min: number, diameter: number]> From 3f37ba02d629f95fec11d33c3a096fc5a152716e Mon Sep 17 00:00:00 2001 From: MyoungHo Kim <34343507+yahma25@users.noreply.github.com> Date: Mon, 3 Jan 2022 20:48:45 +0900 Subject: [PATCH 06/12] Update docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts Co-authored-by: Kibeom Kwon --- docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts index 80c31870..1c423f57 100644 --- a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -16,7 +16,7 @@ type AddMax = [max: number, ...rest: T]; type MaxMin = AddMax<[min: number]> type MaxMinDiameter = AddMax<[min: number, diameter: number]> -// 튜플 이후에도 똑같이 사용 할 수 있습니다: +// 튜플 뒤에도 동일하게 사용 할 수 있습니다: type SuffixDIContext = [...first: T, context: any]; type DIContainer = SuffixDIContext<[param: string]> From 0e6aef9d4a0213726b0a9ac44280d8cb6fd28417 Mon Sep 17 00:00:00 2001 From: MyoungHo Kim <34343507+yahma25@users.noreply.github.com> Date: Mon, 3 Jan 2022 20:49:08 +0900 Subject: [PATCH 07/12] Update docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts Co-authored-by: Kibeom Kwon --- docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts index 1c423f57..f35ac8f9 100644 --- a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -30,7 +30,7 @@ function joinWithNullTerminators(t: [. // TypeScript는 다음과 같이 함수의 반환 타입을 추론할 수 있습니다: const result = joinWithNullTerminators(['variadic', 'types'], ["terminators", 3]); -// 이런 도구를 사용하여 함수형 프로그래밍에서 잘 적용된 개념인 +// 이런 도구를 사용하여 함수형 프로그래밍에서 자주 사용되는 개념인 // curry 함수처럼 올바르게 입력 할 수 있습니다: function curry(f: (...args: [...T, ...U]) => R, ...a: T) { From 37b9284bba57079bcb3b5b33d6ba3375e3dbab5b Mon Sep 17 00:00:00 2001 From: MyoungHo Kim <34343507+yahma25@users.noreply.github.com> Date: Mon, 3 Jan 2022 20:50:29 +0900 Subject: [PATCH 08/12] Update docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts Co-authored-by: Kibeom Kwon --- docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts index f35ac8f9..9f1fa9ae 100644 --- a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -48,6 +48,6 @@ const a = curry(sum, 1, 2) const b = curry(sum, 1)(2) const c = curry(sum)(1, 2) -// 여기에서 더 많은 코드 예시와 함께 더 상세한 설명을 찾아볼 수 있습니다 +// 여기에서 더 많은 코드 예시와 자세한 설명을 확인할 수 있습니다. // https://github.com/microsoft/TypeScript/pull/39094 From 722a29ede232ea06a939c7e2dd25bf0a34f97ccc Mon Sep 17 00:00:00 2001 From: mhkim Date: Mon, 3 Jan 2022 22:00:36 +0900 Subject: [PATCH 09/12] Fix the JSON.parse error refs: commit(35ad1c2e705041e8a278fb6f1b88c4fd133fa32a) --- docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts index 9f1fa9ae..00feee65 100644 --- a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -1,4 +1,4 @@ -//// { compiler: { ts: "4.0.2" } } +//// { "compiler": { "ts": "4.0.2" } } // 가변 튜플은 제네릭이 동작하는 방식처럼 타입을 타입 검사기에 전달하기 위해 // 나머지 연산자(...)를 처리하는 기능을 튜플에게 제공합니다. From 7b292e919b1973ed61937db6c4fb95526ae6ba86 Mon Sep 17 00:00:00 2001 From: mhkim Date: Mon, 3 Jan 2022 22:02:02 +0900 Subject: [PATCH 10/12] Remove 1 space refs: commit(35ad1c2e705041e8a278fb6f1b88c4fd133fa32a) --- docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts index 00feee65..060d85c1 100644 --- a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -8,7 +8,7 @@ // 먼저 튜플 앞에 항상 숫자를 붙이는 // 항상 앞에 붙이는 가변 튜플이 있습니다: -type AddMax = [max: number, ...rest: T]; +type AddMax = [max: number, ...rest: T]; // ^ T를 제한하기 위해 사용한 제네릭 // ^ 어디에 병합하는지 나타내기 위해 사용한 ... From f7caedf7eec74adaaf397f593aedc7ce41da3967 Mon Sep 17 00:00:00 2001 From: MyoungHo Kim <34343507+yahma25@users.noreply.github.com> Date: Mon, 3 Jan 2022 22:04:10 +0900 Subject: [PATCH 11/12] Update docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts Co-authored-by: Kibeom Kwon --- docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts index 060d85c1..e610e9fa 100644 --- a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -6,7 +6,7 @@ // example:generic-functions 그리고 example:tuples를 기반으로 합니다. // 먼저 튜플 앞에 항상 숫자를 붙이는 -// 항상 앞에 붙이는 가변 튜플이 있습니다: +// 가변 튜플이 있습니다. type AddMax = [max: number, ...rest: T]; // ^ T를 제한하기 위해 사용한 제네릭 From d204567cd9274997f482ef5c0403507a1e8633fe Mon Sep 17 00:00:00 2001 From: MyoungHo Kim <34343507+yahma25@users.noreply.github.com> Date: Mon, 3 Jan 2022 22:04:20 +0900 Subject: [PATCH 12/12] Update docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts Co-authored-by: Kibeom Kwon --- docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts index e610e9fa..c714fc72 100644 --- a/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts +++ b/docs/playground/ko/4-0/New TS Features/Variadic Tuples.ts @@ -31,7 +31,7 @@ function joinWithNullTerminators(t: [. const result = joinWithNullTerminators(['variadic', 'types'], ["terminators", 3]); // 이런 도구를 사용하여 함수형 프로그래밍에서 자주 사용되는 개념인 -// curry 함수처럼 올바르게 입력 할 수 있습니다: +// curry같은 함수의 타입을 올바르게 지정할 수 있습니다. function curry(f: (...args: [...T, ...U]) => R, ...a: T) { return (...b: U) => f(...a, ...b);