Skip to content

Add files from old Korean repo to ko #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions docs/documentation/ko/Nightly Builds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title: Nightly Builds
layout: docs
permalink: /ko/docs/handbook/nightly-builds.html
oneline: How to use a nightly build of TypeScript
translatable: true
---

[TypeScript의 `master`](https://github.com/Microsoft/TypeScript/tree/master) 브랜치의 nightly 빌드는 태평양 표준시(PST) 자정까지 NPM에 배포됩니다.
도구를 사용하여 가져오는 방법과 사용하는 방법은 다음과 같습니다.

## npm 사용하기 (Using npm)

```shell
npm install -g typescript@next
```

## nightly 빌드를 사용하도록 IDE 업데이트 (Updating your IDE to use the nightly builds)

nightly drop을 사용하도록 IDE를 업데이트할 수 있습니다.
먼저 npm을 통해 패키지를 설치해야 합니다.
npm 패키지를 전역으로 설치하거나 로컬에 있는 `node_modules` 폴더에 설치할 수 있습니다.

이 섹션의 나머지 부분에서는 `typescript@next`가 이미 설치되어 있다고 가정합니다.

### 비주얼 스튜디오 코드 (Visual Studio Code)

`.vscode/settings.json` 파일을 다음과 같이 업데이트하세요:

```json
"typescript.tsdk": "<path to your folder>/node_modules/typescript/lib"
```

자세한 내용은 [VSCode 문서](https://code.visualstudio.com/Docs/languages/typescript#_using-newer-typescript-versions)를 참조하세요.

### 서브라임 텍스트 (Sublime Text)

`Settings - User` 파일을 다음과 같이 업데이트하세요:

```json
"typescript_tsdk": "<path to your folder>/node_modules/typescript/lib"
```

자세한 내용은 [서브라임 텍스트를 위한 TypeScript 플러그인 설치 문서](https://github.com/Microsoft/TypeScript-Sublime-Plugin#installation)를 참조하세요.

### 비주얼 스튜디오 2013 및 2015 (Visual Studio 2013 and 2015)

> 주의사항: 대부분의 변경 사항에는 새로운 버전의 VS TypeScript 플러그인을 설치할 필요는 없습니다.

현재 nightly 빌드에는 전체 플러그인 설정이 포함되어 있지 않지만 nightly 기반으로 설치 프로그램을 배포하기 위해 노력하고 있습니다.

1. [VSDevMode.ps1](https://github.com/Microsoft/TypeScript/blob/master/scripts/VSDevMode.ps1) 스크립트를 다운로드하세요.

> 또한 [커스텀 언어 서비스 파일 사용](https://github.com/Microsoft/TypeScript/wiki/Dev-Mode-in-Visual-Studio#using-a-custom-language-service-file)에 대한 위키 페이지를 참조하세요.

2. PowerShell 커맨드 라인 창에서 다음을 실행합니다:

VS 2015:

```posh
VSDevMode.ps1 14 -tsScript <path to your folder>/node_modules/typescript/lib
```

VS 2013:

```posh
VSDevMode.ps1 12 -tsScript <path to your folder>/node_modules/typescript/lib
```

### IntelliJ IDEA (Mac)

`Preferences` > `Languages & Frameworks` > `TypeScript`를 선택합니다:

> TypeScript 버전: npm으로 설치한 경우: `/usr/local/lib/node_modules/typescript/lib`

### IntelliJ IDEA (Windows)

`File` > `Settings` > `Languages & Frameworks` > `TypeScript`를 선택합니다:

> TypeScript 버전: npm으로 설치한 경우: `C:\Users\USERNAME\AppData\Roaming\npm\node_modules\typescript\lib`
263 changes: 263 additions & 0 deletions docs/documentation/ko/declaration-files/By Example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
---
title: Declaration Reference
layout: docs
permalink: /ko/docs/handbook/declaration-files/by-example.html
oneline: "How to create a d.ts file for a module"
---

# 소개 (Introduction)

이 가이드는 양질의 선언 파일을 작성하는 방법을 설명하기 위해 작성되었습니다.
이 가이드는 일부 API 문서를 해당 API 사용 예시와 함께 보여주고,
상응하는 선언을 작성하는 방법을 설명합니다.

예제는 대체로 후반부로 갈수록 복잡해집니다.

* [프로퍼티를 갖는 객체 (Objects with Properties)](#프로퍼티를-갖는-객체-objects-with-properties)
* [오버로드된 함수 (Overloaded Function)](#오버로드된-함수-overloaded-functions)
* [재사용 가능한 타입 (인터페이스) (Reusable Types (Interfaces))](#재사용-가능한-타입-인터페이스-reusable-types-interfaces)
* [재사용 가능한 타입 (타입 별칭) (Reusable Types (Type Aliases))](#재사용-가능한-타입-타입-별칭-reusable-types-type-aliases)
* [타입 구조화하기 (Organizing Types)](#타입-구조화하기-organizing-types)
* [클래스 (Classes)](#클래스-classes)
* [전역 변수 (Global Variables)](#전역-변수-global-variables)
* [전역 함수 (Global Functions)](#전역-함수-global-functions)

# 예제 (The Examples)

## 프로퍼티를 갖는 객체 (Objects with Properties)

_문서_

> 전역 변수 `myLib`에는 인사말을 만드는 함수 `makeGreeting`와,
> 지금까지 생성한 인사말의 수를 가리키는 `numberOfGreetings` 프로퍼티가 있습니다.

_코드_

```ts
let result = myLib.makeGreeting("hello, world");
console.log("The computed greeting is:" + result);

let count = myLib.numberOfGreetings;
```

_선언_

점 표기법으로 접근하는 타입이나 값을 설명하기 위해 `declare namespace`를 사용하세요.

```ts
declare namespace myLib {
function makeGreeting(s: string): string;
let numberOfGreetings: number;
}
```

## 오버로드된 함수 (Overloaded Functions)

_문서_

`getWidget` 함수는 숫자를 인자로 받아 Widget을 반환하거나, 문자열을 인자로 받아 Widget 배열을 반환합니다.

_코드_

```ts
let x: Widget = getWidget(43);

let arr: Widget[] = getWidget("all of them");
```

_선언_

```ts
declare function getWidget(n: number): Widget;
declare function getWidget(s: string): Widget[];
```

## 재사용 가능한 타입 (인터페이스) (Reusable Types (Interfaces))

_문서_

> greeting을 명시할 때, 반드시 `GreetingSettings` 객체를 전달해야 합니다.
> 이 객체는 다음의 프로퍼티를 갖고 있습니다:
>
> 1 - greeting: 필수 문자열
>
> 2 - duration: 선택적 시간 (밀리초)
>
> 3 - color: 선택적 문자열, 예. '#ff00ff'

_코드_

```ts
greet({
greeting: "hello world",
duration: 4000
});
```

_선언_

프로퍼티를 갖는 타입을 정의하기 위해 `interface`를 사용하세요.

```ts
interface GreetingSettings {
greeting: string;
duration?: number;
color?: string;
}

declare function greet(setting: GreetingSettings): void;
```

## 재사용 가능한 타입 (타입 별칭) (Reusable Types (Type Aliases))

_문서_

> 인사말이 예상되는 어느 곳에나, `string`, `string`을 반환하는 함수, 또는 `Greeter` 인스턴스를 전달할 수 있습니다.

_코드_

```ts
function getGreeting() {
return "howdy";
}
class MyGreeter extends Greeter { }

greet("hello");
greet(getGreeting);
greet(new MyGreeter());
```

_선언_

타입에 대한 약칭으로 타입 별칭을 사용할 수 있습니다:

```ts
type GreetingLike = string | (() => string) | Greeter;

declare function greet(g: GreetingLike): void;
```

## 타입 구조화하기 (Organizing Types)

_문서_

> `greeter` 객체는 파일에 로그를 작성하거나 경고 창을 띄울 수 있습니다.
> 로그 옵션을 `.log(...)` 내부에, 경고 창 옵션을 `.alert(...)` 내부에 전달할 수 있습니다.

_코드_

```ts
const g = new Greeter("Hello");
g.log({ verbose: true });
g.alert({ modal: false, title: "Current Greeting" });
```

_선언_

타입을 구조화하기 위해 네임스페이스를 사용하세요.

```ts
declare namespace GreetingLib {
interface LogOptions {
verbose?: boolean;
}
interface AlertOptions {
modal: boolean;
title?: string;
color?: string;
}
}
```

중첩된 네임스페이스를 하나의 선언으로 만들 수 있습니다:

```ts
declare namespace GreetingLib.Options {
// Refer to via GreetingLib.Options.Log
interface Log {
verbose?: boolean;
}
interface Alert {
modal: boolean;
title?: string;
color?: string;
}
}
```

## 클래스 (Classes)

_문서_

> `Greeter` 객체를 인스턴스화해서 greeter를 생성하거나, 이 객체를 상속해서 커스텀 greeter를 생성할 수 있습니다.

_코드_

```ts
const myGreeter = new Greeter("hello, world");
myGreeter.greeting = "howdy";
myGreeter.showGreeting();

class SpecialGreeter extends Greeter {
constructor() {
super("Very special greetings");
}
}
```

_선언_

클래스 혹은 클래스-같은 객체를 설명하기 위해 `declare class`를 사용하세요.
클래스는 생성자 뿐만 아니라 프로퍼티와 메서드를 가질 수 있습니다.

```ts
declare class Greeter {
constructor(greeting: string);

greeting: string;
showGreeting(): void;
}
```

## 전역 변수 (Global Variables)

_문서_

> 전역 변수 `foo`는 존재하는 위젯의 수를 포함합니다.

_코드_

```ts
console.log("Half the number of widgets is " + (foo / 2));
```

_선언_

변수를 선언하기 위해 `declare var`를 사용하세요.
만약 변수가 읽기-전용이라면, `declare const`를 사용하세요.
변수가 블록-스코프인 경우 `declare let` 또한 사용할 수 있습니다.

```ts
/** 존재하는 위젯의 수 */
declare var foo: number;
```

## 전역 함수 (Global Functions)

_문서_

> 사용자에게 인사말을 보여주기 위해 `greet` 함수를 호출할 수 있습니다.

_코드_

```ts
greet("hello, world");
```

_선언_

함수를 선언하기 위해 `declare function`을 사용하세요.

```ts
declare function greet(greeting: string): void;
```
47 changes: 47 additions & 0 deletions docs/documentation/ko/declaration-files/Consumption.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: Consumption
layout: docs
permalink: /ko/docs/handbook/declaration-files/consumption.html
oneline: "How to download d.ts files for your project"
---

TypeScript 2.0에서는 선언 파일을 얻고, 사용하고, 찾는 것이 훨씬 쉬워졌습니다.
이 페이지에서 세 가지를 어떻게 하는지 정확하게 설명합니다.

## 다운로드 (Downloading)

TypeScript 2.0 이상에서 타입 선언을 가져오는데 npm 이외의 도구는 필요하지 않습니다.

예를 들어, lodash와 같은 라이브러리에 대한 선언을 얻는 것은 다음 명령어로 충분합니다.

```cmd
npm install --save @types/lodash
```

[Publishing](/docs/handbook/declaration-files/publishing.html)에서 설명한 대로 npm 패키지에 이미 선언 파일이 포함되어 있다면, `@types` 패키지를 설치할 필요는 없다는 걸 유의하세요.

## 사용하기 (Consuming)

TypeScript 코드에 별 어려움 없이 lodash를 사용할 수 있습니다.
이는 모듈 및 전역 코드에 모두 적용됩니다.

예를 들어, 타입 선언에 대해 `npm install`을 한 번만 수행하면, import 하고 사용할 수 있고

```ts
import * as _ from "lodash";
_.padStart("Hello TypeScript!", 20, " ");
```

또는 모듈을 사용하지 않는다면, 전역 변수 `_` 를 사용할 수 있습니다.

```ts
_.padStart("Hello TypeScript!", 20, " ");
```

## 찾기 (Searching)

대부분의 경우, 타입 선언 패키지 이름은 항상 `npm` 상의 패키지 이름과 같아야 하지만, `@types/` 가 앞에 붙어야 합니다.
하지만 필요시 [https://aka.ms/types](https://aka.ms/types) 를 방문해 선호하는 라이브러리의 패키지를 찾으세요.

> 참고: 만약 찾고자 하는 선언 파일이 없는 경우, 언제든지 기여하고, 다음 개발자가 이를 찾는 데 도움을 줄 수 있습니다.
> 자세한 내용은 DefinitelyTyped의 [기여 지침 페이지](http://definitelytyped.org/guides/contributing.html)를 참고하세요.
Loading