diff --git a/.all-contributorsrc b/.all-contributorsrc
index 4123ed92..d6611dbf 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -261,6 +261,15 @@
"contributions": [
"translation"
]
+ },
+ {
+ "login": "seohyun0120",
+ "name": "SeohyunYoon",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/35247295?v=4",
+ "profile": "https://github.com/seohyun0120",
+ "contributions": [
+ "translation"
+ ]
}
],
"contributorsPerLine": 8,
diff --git a/README.md b/README.md
index 27ad8447..4de809af 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# TypeScript-Handbook νκΈ λ¬Έμ
[](https://travis-ci.com/github/typescript-kr/typescript-kr.github.io)
-[](#contributors-)
+[](#contributors-)
[](https://github.com/typescript-kr/typescript-kr.github.io/releases)
[](https://github.com/typescript-kr/typescript-kr.github.io/stargazers)
@@ -63,6 +63,7 @@
 Hyuntae EOM π |
 Yunhoe, Ku π |
 realgo π |
+  SeohyunYoon π |
diff --git a/pages/literal-types.md b/pages/literal-types.md
index e99af150..a5ed89ee 100644
--- a/pages/literal-types.md
+++ b/pages/literal-types.md
@@ -5,35 +5,35 @@ permalink: /docs/handbook/literal-types.html
oneline: Using literal types with TypeScript
---
-A literal is a more concrete sub-type of a collective type.
-What this means is that `"Hello World"` is a `string`, but a `string` is not `"Hello World"` inside the type system.
+리ν°λ΄ νμ
μ μ§ν© νμ
μ λ³΄λ€ κ΅¬μ²΄μ μΈ νμ νμ
μ
λλ€.
+μ΄κ²μ΄ μλ―Ένλ λ°λ νμ
μμ€ν
μμμ `"Hello World"`λ `string`μ΄μ§λ§, `string`μ `"Hello World"`κ° μλλ κ²μ
λλ€.
-There are two sets of literal types available in TypeScript today, strings and numbers, by using literal types you can allow an exact value which a string or number must have.
+μ€λλ TypeScriptμλ λ¬Έμμ΄κ³Ό μ«μ, λ κ°μ§ 리ν°λ΄ νμ
μ΄ μλλ° μ΄λ₯Ό μ¬μ©νλ©΄ λ¬Έμμ΄μ΄λ μ«μμ μ νν κ°μ μ§μ ν μ μμ΅λλ€.
-# Literal Narrowing
+# 리ν°λ΄ νμ
μ’νκΈ° (Literal Narrowing)
-When you declare a variable via `var` or `let`, you are telling the compiler that there is the chance that this variable will change its contents.
-In contrast, using `const` to declare a variable will inform TypeScript that this object will never change.
+`var` λλ `let`μΌλ‘ λ³μλ₯Ό μ μΈν κ²½μ° μ΄ λ³μμ κ°μ΄ λ³κ²½λ κ°λ₯μ±μ΄ μμμ μ»΄νμΌλ¬μκ² μ립λλ€.
+λ°λ©΄, `const`λ‘ λ³μλ₯Ό μ μΈνκ² λλ©΄ TypeScriptμκ² μ΄ κ°μ²΄λ μ λ λ³κ²½λμ§ μμμ μ립λλ€.
-```ts twoslash
-// We're making a guarantee that this variable
-// helloWorld will never change, by using const.
+```ts
+// constλ₯Ό μ¬μ©νμ¬ λ³μ helloWorldκ°
+// μ λ λ³κ²½λμ§ μμμ 보μ₯ν©λλ€.
-// So, TypeScript sets the type to be "Hello World" not string
+// λ°λΌμ, TypeScriptλ λ¬Έμμ΄μ΄ μλ "Hello World"λ‘ νμ
μ μ ν©λλ€.
const helloWorld = "Hello World";
-// On the other hand, a let can change, and so the compiler declares it a string
+// λ°λ©΄, letμ λ³κ²½λ μ μμΌλ―λ‘ μ»΄νμΌλ¬λ λ¬Έμμ΄μ΄λΌκ³ μ μΈν κ²μ
λλ€.
let hiWorld = "Hi World";
```
-The process of going from an infinite number of potential cases (there are an infinite number of possible string values) to a smaller, finite number of potential case (in `helloWorld`'s case: 1) is called narrowing.
+무νν μμ μ μ¬μ μΌμ΄μ€λ€ (λ¬Έμμ΄ κ°μ κ²½μ°μ μκ° λ¬΄νλ)μ μ νν μμ μ μ¬μ μΌμ΄μ€ (`helloWorld`μ κ²½μ°: 1κ°)λ‘ μ€μ¬λκ°λ κ²μ νμ
μ’νκΈ° (narrowing)λΌ νλ€.
-# String Literal Types
+# λ¬Έμμ΄ λ¦¬ν°λ΄ νμ
(String Literal Types)
-In practice string literal types combine nicely with union types, type guards, and type aliases.
-You can use these features together to get enum-like behavior with strings.
+μ€μ λ‘ λ¬Έμμ΄ λ¦¬ν°λ΄ νμ
μ μ λμΈ νμ
, νμ
κ°λ κ·Έλ¦¬κ³ νμ
λ³μΉκ³Ό μ κ²°ν©λ©λλ€.
+μ΄λ° κΈ°λ₯μ ν¨κ» μ¬μ©νμ¬ λ¬Έμμ΄λ‘ enumκ³Ό λΉμ·ν ννλ₯Ό κ°μΆ μ μμ΅λλ€.
-```ts twoslash
+```ts
// @errors: 2345
type Easing = "ease-in" | "ease-out" | "ease-in-out";
@@ -44,8 +44,8 @@ class UIElement {
} else if (easing === "ease-out") {
} else if (easing === "ease-in-out") {
} else {
- // It's possible that someone could reach this
- // by ignoring your types though.
+ // νμ§λ§ λκ΅°κ°κ° νμ
μ 무μνκ² λλ€λ©΄
+ // μ΄κ³³μ λλ¬νκ² λ μ μμ΅λλ€.
}
}
}
@@ -55,28 +55,28 @@ button.animate(0, 0, "ease-in");
button.animate(0, 0, "uneasy");
```
-You can pass any of the three allowed strings, but any other string will give the error
+νμ©λ μΈ κ°μ λ¬Έμμ΄μ΄ μλ λ€λ₯Έ λ¬Έμμ΄μ μ¬μ©νκ² λλ©΄ μ€λ₯κ° λ°μν©λλ€.
```
-Argument of type '"uneasy"' is not assignable to parameter of type '"ease-in" | "ease-out" | "ease-in-out"'
+'"uneasy"' νμ
μ '"ease-in" | "ease-out" | "ease-in-out"' νμ
μ λ§€κ° λ³μμ ν λΉν μ μμ΅λλ€.
```
-String literal types can be used in the same way to distinguish overloads:
+λ¬Έμμ΄ λ¦¬ν°λ΄ νμ
μ μ€λ²λ‘λλ₯Ό ꡬλ³νλ κ²κ³Ό λμΌν λ°©λ²μΌλ‘ μ¬μ©λ μ μμ΅λλ€:
```ts
function createElement(tagName: "img"): HTMLImageElement;
function createElement(tagName: "input"): HTMLInputElement;
-// ... more overloads ...
+// ... μΆκ°μ μΈ μ€λ³΅ μ μλ€ ...
function createElement(tagName: string): Element {
- // ... code goes here ...
+ // ... μ¬κΈ°μ λ‘μ§ μΆκ° ...
}
```
-# Numeric Literal Types
+# μ«μν 리ν°λ΄ νμ
(Numeric Literal Types)
-TypeScript also has numeric literal types, which act the same as the string literals above.
+TypeScriptμλ μμ λ¬Έμμ΄ λ¦¬ν°λ΄κ³Ό κ°μ μν μ νλ μ«μν 리ν°λ΄ νμ
λ μμ΅λλ€.
-```ts twoslash
+```ts
function rollDice(): 1 | 2 | 3 | 4 | 5 | 6 {
return (Math.floor(Math.random() * 6) + 1) as 1 | 2 | 3 | 4 | 5 | 6;
}
@@ -84,12 +84,12 @@ function rollDice(): 1 | 2 | 3 | 4 | 5 | 6 {
const result = rollDice();
```
-A common case for their use is for describing config values:
+μ΄λ μ£Όλ‘ μ€μ κ°μ μ€λͺ
ν λ μ¬μ©λ©λλ€:
-```ts twoslash
-/** Creates a map centered at loc/lat */
+```ts
+/** loc/lat μ’νμ μ§λλ₯Ό μμ±ν©λλ€. */
declare function setupMap(config: MapConfig): void;
-// ---cut---
+// ---μλ΅---
interface MapConfig {
lng: number;
lat: number;
diff --git a/pages/tutorials/babel-with-typescript.md b/pages/tutorials/babel-with-typescript.md
index afb3dd6f..4cfd6fd9 100644
--- a/pages/tutorials/babel-with-typescript.md
+++ b/pages/tutorials/babel-with-typescript.md
@@ -5,44 +5,44 @@ permalink: /docs/handbook/babel-with-typescript.html
oneline: How to create a hybrid Babel + TypeScript project
---
-# Babel vs `tsc` for TypeScript
+# Babel vs TypeScriptμ `tsc`
-When making a modern JavaScript project, you might ask yourself what the right way to convert files from TypeScript to JavaScript.
+λͺ¨λ JavaScript νλ‘μ νΈλ₯Ό λ§λ€ λ, TypeScriptμμ JavaScript νμΌλ‘ λ³ννλ μ¬λ°λ₯Έ λ°©λ²μ λν΄ κ³ λ―Όν μ μμ΅λλ€.
-A lot of the time the answer is _"it depends"_, or _"someone may have decided for you"_ depending on the project. If you are building your project with an existing framework like [tsdx](https://www.npmjs.com/package/tsdx), [Angular](https://angular.io/), [NestJS](https://nestjs.com/) or any framework mentioned in the [Getting Started](/docs/home) then this decision is handled for you.
+λ§μ κ²½μ° κ·Έ λλ΅μ νλ‘μ νΈμ λ°λΌ _"~μ λ¬λ €μλ€"_ λλ _"λκ΅°κ° μ¬λ¬λΆ λμ κ²°μ νμμ§λ λͺ¨λ₯Έλ€`_ κ° λ κ²μ
λλ€. λ§μ½ [tsdx](https://www.npmjs.com/package/tsdx), [Angular](https://angular.io/), [NestJS](https://nestjs.com/)μ κ°μ κΈ°μ‘΄ νλ μμν¬ λλ [Getting Started](/docs/home)μ μΈκΈλ νλ μμν¬λ₯Ό μ¬μ©νμ¬ νλ‘μ νΈλ₯Ό λ§λ€κ³ μλ€λ©΄ κ²°μ μ μ¬λ¬λΆ μμ λ¬λ €μμ΅λλ€.
-However, a useful heuristic could be:
+νμ§λ§, μ¬μ©ν λ§ν μ§κ΄μ μΈ λ°©λ²μ λ€μκ³Ό κ°μ΅λλ€:
-* Is your build output mostly the same as your source input files? Use `tsc`
-* Do you need a build pipeline with multiple potential outputs? Use `babel` for transpiling and `tsc` for type checking
+* λΉλ μΆλ ₯ κ²°κ³Όμ μμ€ μ
λ ₯ νμΌμ΄ κ±°μ λΉμ·νκ°μ? `tsc`λ₯Ό μ¬μ©νμΈμ.
+* μ¬λ¬ μ μ¬μ μΈ κ²°κ³Όλ¬Όμ λ΄λ λΉλ νμ΄νλΌμΈμ΄ νμνμ κ°μ? `babel`λ‘ νΈλμ€νμΌλ§μ νκ³ , `tsc`λ‘ νμ
μ κ²μ¬νμΈμ.
-## Babel for transpiling, `tsc` for types
+## νΈλμ€νμΌλ§μ Babel, νμ
μ `tsc` (Babel for transpiling, `tsc` for types)
-This is a common pattern for projects with existing build infrastructure which may have been ported from a JavaScript codebase to TypeScript.
+JavaScript μ½λ λ² μ΄μ€μμ TypeScriptλ‘ ν¬ν
λμμ μ μλ κΈ°μ‘΄ λΉλ μΈνλΌ κ΅¬μ‘°λ₯Ό κ°μ§ νλ‘μ νΈμ μΌλ°μ μΈ ν¨ν΄μ
λλ€.
-This technique is a hybrid approach, using Babel's [preset-typescript](https://babeljs.io/docs/en/babel-preset-typescript) to generate your JS files, and then using TypeScript to do type checking and `.d.ts` file generation.
+μ΄ κΈ°μ μ, Babelμ [preset-typescript](https://babeljs.io/docs/en/babel-preset-typescript)μ μ¬μ©νμ¬ JS νμΌμ μμ±ν ν, TypeScriptλ₯Ό μ¬μ©νμ¬ νμ
κ²μ¬ λ° `.d.ts` νμΌμ μμ±νλ λ³΅ν© μ κ·Ό λ°©μμ
λλ€.
-By using babel's support for TypeScript, you get the ability to work with existing build pipelines and are more likely to have a faster JS emit time because Babel does not type check your code.
+Babelμ TypeScriptλ₯Ό μ§μνκΈ° λλ¬Έμ, κΈ°μ‘΄ λΉλ νμ΄νλΌμΈμΌλ‘ μμ
ν μ μκ³ Babelμ΄ μ½λ νμ
μ κ²μ¬νμ§ μκΈ° λλ¬Έμ JS μΆλ ₯ μκ°μ΄ λ λΉ¨λΌμ§ μ μμ΅λλ€.
-#### Type Checking and d.ts file generation
+#### νμ
κ²μ¬μ d.ts νμΌ μμ± (Type Checking and d.ts file generation)
-The downside to using babel is that you don't get type checking during the transition from TS to JS. This can mean that type errors which you miss in your editor could sneak through into production code.
+Babel μ¬μ©μ λ¨μ μ TSλ₯Ό JSλ‘ μ ννλ λμ νμ
κ²μ¬λ₯Ό ν μ μλ€λ μ μ
λλ€. μ¦, μλν°μμ νμ
μ€λ₯λ₯Ό μ‘μ§ λͺ»νκ³ μμ© μ½λμ ν¬ν¨λ μλ μλ¨ λ»μ
λλ€.
-In addition to that, Babel cannot create `.d.ts` files for your TypeScript which can make it harder to work with your project if it is a library.
+λν, Babelμ TypeScriptμ λν `.d.ts` νμΌμ λ§λ€ μ μκΈ° λλ¬Έμ μ¬λ¬λΆμ νλ‘μ νΈκ° λΌμ΄λΈλ¬λ¦¬μΈ κ²½μ° μμ
νκΈ°κ° λ μ΄λ €μμ§ μ μμ΅λλ€.
-To fix these issues, you would probably want to set up a command to type check your project using TSC. This likely means duplicating some of your babel config into a corresponding [`tsconfig.json`](/tconfig) and ensuring these flags are enabled:
+μ΄λ¬ν λ¬Έμ λ₯Ό ν΄κ²°νλ €λ©΄ TSCλ₯Ό μ¬μ©νμ¬ νλ‘μ νΈμ νμ
μ κ²μ¬ν μ μλ λͺ
λ Ήμ΄λ₯Ό μ€μ νλ κ²μ΄ μ’μ΅λλ€. μ΄λ Babel ꡬμ±μ μΌλΆλ₯Ό ν΄λΉ [`tsconfig.json`](/tconfig)μ 볡μ νκ³ , λ€μ νλκ·Έκ° νμ±νλμλμ§ νμΈνλ κ²μ μλ―Έν©λλ€:
```json
"compilerOptions": {
- // Ensure that .d.ts files are created by tsc, but not .js files
+ // tscλ₯Ό μ¬μ©ν΄ .js νμΌμ΄ μλ .d.ts νμΌμ΄ μμ±λμλμ§ νμΈν©λλ€.
"declaration": true,
"emitDeclarationOnly": true,
- // Ensure that Babel can safely transpile files in the TypeScript project
+ // Babelμ΄ TypeScript νλ‘μ νΈμ νμΌμ μμ νκ² νΈλμ€νμΌν μ μλμ§ νμΈν©λλ€.
"isolatedModules": true
}
```
-For more information on these flags:
+ν΄λΉ νλκ·Έμ λν μμΈν λ΄μ©μ λ€μμ μ°Έκ³ ν΄μ£ΌμΈμ:
* [`isolatedModules`](/tsconfig#isolatedModules)
* [`declaration`](/tsconfig#declaration), [`emitDeclarationOnly`](/tsconfig#emitDeclarationOnly)
\ No newline at end of file