Skip to content

Commit eff8d78

Browse files
committed
translated Explicit Types and Erased Types paragraph
1 parent 8c45db9 commit eff8d78

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

docs/documentation/ko/handbook-v2/Basics.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -289,23 +289,23 @@ tsc --noEmitOnError hello.ts
289289

290290
`hello.js`가 하나도 수정되지 않는다는 것을 확인할 수 있습니다.
291291

292-
## Explicit Types
292+
## 명시적 타입
293293

294-
Up until now, we haven't told TypeScript what `person` or `date` are.
295-
Let's edit the code to tell TypeScript that `person` is a `string`, and that `date` should be a `Date` object.
296-
We'll also use the `toDateString()` method on `date`.
294+
지금까지는 아직 TypeScript에게 `person` 또는 `date`가 무엇인지 알려주지 않았습니다.
295+
코드를 수정하여 TypeScript가 `person``string`이고 `date``Date` 객체이어야 한다는 것을 알려주도록 하죠.
296+
또한 `date``toDateString()` 메서드를 사용하겠습니다.
297297

298298
```ts twoslash
299299
function greet(person: string, date: Date) {
300300
console.log(`Hello ${person}, today is ${date.toDateString()}!`);
301301
}
302302
```
303303

304-
What we did was add _type annotations_ on `person` and `date` to describe what types of values `greet` can be called with.
305-
You can read that signature as "`greet` takes a `person` of type `string`, and a `date` of type `Date`".
304+
방금 우리는 `person``date`에 대하여 _타입 표기_를 수행하여 `greet`가 호출될 때 함께 사용될 수 있는 값들의 타입을 설명했습니다.
305+
해당 시그니처는 "`greet``string` 타입의 `person``Date` 타입의 `date`을 가진다"고 해석할 수 있습니다.
306306

307-
With this, TypeScript can tell us about other cases where we might have been called incorrectly.
308-
For example...
307+
이것이 있다면, TypeScript는 우리가 해당 함수를 올바르지 못하게 사용했을 경우 이를 알려줄 수 있게 됩니다.
308+
예를 들어...
309309

310310
```ts twoslash
311311
// @errors: 2345
@@ -316,13 +316,13 @@ function greet(person: string, date: Date) {
316316
greet("Maddison", Date());
317317
```
318318

319-
Huh?
320-
TypeScript reported an error on our second argument, but why?
319+
?
320+
TypeScript가 두번째 인자에 대하여 오류를 보고했는데요, 왜 그랬을까요?
321321

322-
Perhaps surprisingly, calling `Date()` in JavaScript returns a `string`.
323-
On the other hand, constructing a `Date` with `new Date()` actually gives us what we were expecting.
322+
아마도 놀랍게도, JavaScript에서 `Date()`를 호출하면 `string`을 반환합니다.
323+
반면, `new Date()`를 사용하여 `Date` 타입을 생성해야 비로소 처음 기대했던 결과를 반환받을 수 있게 됩니다.
324324

325-
Anyway, we can quickly fix up the error:
325+
어쨌든, 이 오류는 아주 빠르게 고칠 수 있습니다.
326326

327327
```ts twoslash {4}
328328
function greet(person: string, date: Date) {
@@ -332,22 +332,22 @@ function greet(person: string, date: Date) {
332332
greet("Maddison", new Date());
333333
```
334334

335-
Keep in mind, we don't always have to write explicit type annotations.
336-
In many cases, TypeScript can even just _infer_ (or "figure out") the types for us even if we omit them.
335+
명시적인 타입 표기를 항상 작성할 필요는 없다는 것을 꼭 기억해두세요.
336+
많은 경우, TypeScript는 생략된 타입 정보를 _추론할 수_ (또는 "알아낼 수") 있습니다.
337337

338338
```ts twoslash
339339
let msg = "hello there!";
340340
// ^?
341341
```
342342

343-
Even though we didn't tell TypeScript that `msg` had the type `string` it was able to figure that out.
344-
That's a feature, and it's best not to add annotations when the type system would end up inferring the same type anyway.
343+
`msg``string` 타입을 가진다는 사실을 TypeScript에게 알려주지 않았더라도 TypeScript는 이를 알아낼 수 있습니다.
344+
이는 기본 기능이며, 타입 시스템이 알아서 올바른 타입을 어떻게든 잘 알아낼 수 있다면 타입 표기를 굳이 적지 않는 것이 가장 좋습니다.
345345

346-
> Note: the message bubble inside the code sample above. That is what your editor would show if you had hovered over the word.
346+
> 참고: 바로 위 코드의 말풍선은 에디터에서 해당 코드를 작성했을 때, 해당 변수에 마우스 호버시 화면에 나타나는 내용입니다.
347347
348-
## Erased Types
348+
## 지워진 타입
349349

350-
Let's take a look at what happens when we compile the above function `greet` with `tsc` to output JavaScript:
350+
앞서 작성한 함수 `greet``tsc`로 컴파일하여 JavaScript 출력을 얻었을 때 어떤 일이 일어나는지 보도록 하겠습니다.
351351

352352
```ts twoslash
353353
// @showEmit
@@ -359,17 +359,17 @@ function greet(person: string, date: Date) {
359359
greet("Maddison", new Date());
360360
```
361361

362-
Notice two things here:
362+
여기서 두 가지를 알 수 있습니다.
363363

364-
1. Our `person` and `date` parameters no longer have type annotations.
365-
2. Our "template string" - that string that used backticks (the `` ` `` character) - was converted to plain strings with concatenations (`+`).
364+
1. `person``date` 인자는 더 이상 타입 표기를 가지지 않습니다.
365+
2. "템플릿 문자열" - 백틱(`` ` `` 문자)을 사용하여 작성된 문장 - 은 연결 연산자(`+`)로 이루어진 일반 문자열로 변환되었습니다.
366366

367-
More on that second point later, but let's now focus on that first point.
368-
Type annotations aren't part of JavaScript (or ECMAScript to be pedantic), so there really aren't any browsers or other runtimes that can just run TypeScript unmodified.
369-
That's why TypeScript needs a compiler in the first place - it needs some way to strip out or transform any TypeScript-specific code so that you can run it.
370-
Most TypeScript-specific code gets erased away, and likewise, here our type annotations were completely erased.
367+
두번째 항목에 대하여서는 이후 자세히 다로도록 하고 우선 첫번째 항목에 초점을 두도록 하겠습니다.
368+
타입 표기는 JavaScript(또는 엄밀히 말하여 ECMAScript)의 일부가 아니므로, TypeScript를 수정 없이 그대로 실행할 수 있는 브라우저나 런타임을 현재 존재하지 않습니다.
369+
이것이 TypeScript를 사용하고자 할 때 다른 무엇보다도 컴파일러가 필요한 이유입니다. TypeScript 전용 코드를 제거하거나 변환하여 실행할 수 있도록 만들 방법이 필요합니다.
370+
TypeScript 전용 코드의 대부분은 제거되며, 마찬가지로 타입 표기 또한 완전히 지워집니다.
371371

372-
> **Remember**: Type annotations never change the runtime behavior of your program.
372+
> **기억하세요**: 타입 표기는 프로그램의 런타임 동작을 전혀 수정하지 않습니다.
373373
374374
## Downleveling
375375

0 commit comments

Comments
 (0)