Skip to content

Commit d42e88c

Browse files
authored
Merge pull request #4 from microsoft/main
Updating fork
2 parents 5642c89 + fb8ae94 commit d42e88c

File tree

18 files changed

+595
-1
lines changed

18 files changed

+595
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Update Attributions Weekly
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# https://crontab.guru/#0_6_*_*_*
7+
- cron: '0 6 * * *'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v1

.github/workflows/weekly.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
1518
- uses: actions/setup-node@v1
19+
with:
20+
node-version: 12
21+
registry-url: https://registry.npmjs.org/
1622
- run: yarn install
1723
env:
1824
YARN_CHECKSUM_BEHAVIOR: ignore
@@ -21,3 +27,17 @@ jobs:
2127
- run: yarn docs-sync update-github-issues microsoft/TypeScript-Website-Localizations
2228
env:
2329
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
# Updates the attribution.json file in git
32+
- uses: OSS-Docs-Tools/create-attribution-json@master
33+
with:
34+
glob: "docs/documentation/**/*.md"
35+
36+
- name: Configure git and update attribution.json
37+
run: |
38+
git config user.email "[email protected]"
39+
git config user.name "GitHub Bot"
40+
git add -f attribution.json
41+
if git commit -m "Update attribution.json"; then
42+
git push
43+
fi

attribution.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"docs/documentation/id/Nightly Builds.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ja/Nightly Builds.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/Nightly Builds.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/zh/Nightly Builds.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/javascript/Creating DTS files From JS.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/javascript/Intro to JS with TS.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/javascript/JSDoc Reference.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":7},{"name":"Orta Therox","gravatar":"28e997da43c10d99aa99273b48efe8cf","count":1}],"total":2},"docs/documentation/id/project-config/Configuring Watch.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/reference/Decorators.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/reference/Iterators and Generators.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/reference/JSX.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/reference/Mixins.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/reference/Symbols.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/tutorials/Babel with TypeScript.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/tutorials/DOM Manipulation.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/tutorials/React.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/id/tutorials/TypeScript Tooling in 5 minutes.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ja/javascript/Creating DTS files From JS.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ja/javascript/Intro to JS with TS.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ja/javascript/JSDoc Reference.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ja/javascript/Type Checking JavaScript Files.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ko/reference/Declaration Merging.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ko/reference/Iterators and Generators.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ko/reference/JSX.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ko/reference/Symbols.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ko/reference/Triple-Slash Directives.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ko/reference/Type Inference.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ko/reference/Utility Types.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/ko/tutorials/Babel with TypeScript.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":8}],"total":1},"docs/documentation/ko/tutorials/React.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":9}],"total":1},"docs/documentation/ko/tutorials/TypeScript Tooling in 5 minutes.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":8}],"total":1},"docs/documentation/pl/handbook-v1/The Handbook.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/javascript/Creating DTS files From JS.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/javascript/Intro to JS with TS.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/javascript/JSDoc Reference.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/javascript/Type Checking JavaScript Files.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/project-config/Configuring Watch.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/project-config/Project References.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/project-config/tsconfig.json.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Declaration Merging.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Decorators.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Iterators and Generators.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/JSX.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Mixins.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":9}],"total":1},"docs/documentation/pt/reference/Module Resolution.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Modules.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Namespaces and Modules.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Namespaces.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Symbols.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Triple-Slash Directives.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Type Compatibility.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Type Inference.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Utility Types.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/reference/Variable Declarations.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/tutorials/Babel with TypeScript.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/tutorials/DOM Manipulation.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/tutorials/React.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/pt/tutorials/TypeScript Tooling in 5 minutes.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1},"docs/documentation/vo/handbook-v1/Basic Types.md":{"top":[{"name":"Orta","gravatar":"bcfa5d8f5699be0134ffb16424b42610","count":6}],"total":1}}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//// { compiler: { noImplicitAny: false }, order: 2 }
2+
3+
// TypeScript 3.7 버전에 있는 '사용법에서 추론한' 코드 수정은
4+
// 더욱 똑똑해졌습니다. 이제부터는 알려진 중요한
5+
// 타입(문자열, 숫자, 배열, 프로미스)의 리스트로 사용되며,
6+
// 이러한 객체의 API와 일치하는 타입의 사용에 따라
7+
// 유추합니다.
8+
9+
// 다음과 같은 예시에서, 함수의 매개변수를 선택하고
10+
// 전구를 클릭하여, "Infer Parameter types..."를
11+
// 선택합니다.
12+
13+
// 숫자 배열을 유추합니다:
14+
15+
function pushNumber(arr) {
16+
arr.push(12);
17+
}
18+
19+
// 프로미스를 유추합니다:
20+
21+
function awaitPromise(promise) {
22+
promise.then((value) => console.log(value));
23+
}
24+
25+
// 함수와 반환 타입을 유추합니다:
26+
27+
function inferAny(app) {
28+
const result = app.use("hi");
29+
return result;
30+
}
31+
32+
// 문자열이 추가 되었음으로,
33+
// 문자열 배열로 유추합니다:
34+
35+
function insertString(names) {
36+
names[1] = "hello";
37+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//// { compiler: { }, order: 3 }
2+
3+
// TypeScript의 오류 메시지는 가끔 필요 이상으로 상세할 수 있습니다...
4+
// 3.7 버전에서, 몇 가지 터무니없는 사례를 보실 수 있습니다.
5+
6+
// 중첩 속성
7+
8+
let a = { b: { c: { d: { e: "string" } } } };
9+
let b = { b: { c: { d: { e: 12 } } } };
10+
11+
a = b;
12+
13+
// 이전에는, 중첩된 속성 당 두 줄의 코드였기에,
14+
// 오류 메시지의 첫 번째와 마지막 줄을 읽음으로써
15+
// 빠르게 오류 메시지를 읽는 방법을 배웠습니다.
16+
17+
// 이제는 인라인입니다:
18+
19+
// 3.6 버전에서는 다음과 같습니다:
20+
//
21+
// Type '{ b: { c: { d: { e: number; }; }; }; }' is not assignable to type '{ b: { c: { d: { e: string; }; }; }; }'.
22+
// Types of property 'b' are incompatible.
23+
// Type '{ c: { d: { e: number; }; }; }' is not assignable to type '{ c: { d: { e: string; }; }; }'.
24+
// Types of property 'c' are incompatible.
25+
// Type '{ d: { e: number; }; }' is not assignable to type '{ d: { e: string; }; }'.
26+
// Types of property 'd' are incompatible.
27+
// Type '{ e: number; }' is not assignable to type '{ e: string; }'.
28+
// Types of property 'e' are incompatible.
29+
// Type 'number' is not assignable to type 'string'
30+
31+
// 유용하고 간결한 오류 메시지를 제공하여,
32+
// 객체의 여러 타입을 통해 작업을 처리할 수 있습니다.
33+
34+
class ExampleClass {
35+
state = "ok";
36+
}
37+
38+
class OtherClass {
39+
state = 12;
40+
}
41+
42+
let x = { a: { b: { c: { d: { e: { f: ExampleClass } } } } } };
43+
let y = { a: { b: { c: { d: { e: { f: OtherClass } } } } } };
44+
x = y;
45+
46+
// 3.6 버전에서는 다음과 같습니다:
47+
//
48+
// Type '{ a: { b: { c: { d: { e: { f: typeof OtherClass; }; }; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: { e: { f: typeof ExampleClass; }; }; }; }; }; }'.
49+
// Types of property 'a' are incompatible.
50+
// Type '{ b: { c: { d: { e: { f: typeof OtherClass; }; }; }; }; }' is not assignable to type '{ b: { c: { d: { e: { f: typeof ExampleClass; }; }; }; }; }'.
51+
// Types of property 'b' are incompatible.
52+
// Type '{ c: { d: { e: { f: typeof OtherClass; }; }; }; }' is not assignable to type '{ c: { d: { e: { f: typeof ExampleClass; }; }; }; }'.
53+
// Types of property 'c' are incompatible.
54+
// Type '{ d: { e: { f: typeof OtherClass; }; }; }' is not assignable to type '{ d: { e: { f: typeof ExampleClass; }; }; }'.
55+
// Types of property 'd' are incompatible.
56+
// Type '{ e: { f: typeof OtherClass; }; }' is not assignable to type '{ e: { f: typeof ExampleClass; }; }'.
57+
// Types of property 'e' are incompatible.
58+
// Type '{ f: typeof OtherClass; }' is not assignable to type '{ f: typeof ExampleClass; }'.
59+
// Types of property 'f' are incompatible.
60+
// Type 'typeof OtherClass' is not assignable to type 'typeof ExampleClass'.
61+
// Type 'OtherClass' is not assignable to type 'ExampleClass'.
62+
// Types of property 'state' are incompatible.
63+
// Type 'number' is not assignable to type 'string'
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
//// { order: 2, compiler: { esModuleInterop: true } }
2+
3+
// 함수 체이닝 API는 JavaScript에서 흔한 패턴으로,
4+
// JavaScript 의 중첩 특성으로 인해
5+
// 중간값을 줄이고 가독성을 높혀
6+
// 코드를 집중시킬 수 있습니다.
7+
8+
// 체이닝으로 동작하는 흔한 API는 jQuery입니다.
9+
// DefinitelyTyped의 타입과 함께 사용한
10+
// jQuery 예시입니다.:
11+
12+
import $ from "jquery";
13+
14+
// jQuery API 사용 예시:
15+
16+
$("#navigation").css("background", "red").height(300).fadeIn(200);
17+
18+
// 위 라인에 점을 추가해보면,
19+
// 긴 함수 리스트를 보게 될 것입니다.
20+
// 이 패턴은 JavaScript에서 쉽게 재현할 수 있습니다.
21+
// 핵심은 반드시 항상 같은 오브젝트를 반환하는 것입니다.
22+
23+
// 여기 체이닝 API를 만드는 API 예시가 있습니다.
24+
// 핵심은 내부 상태를 파악하고 있는 외부 함수와
25+
// 항상 자신을 반환하는 API를
26+
// 노출하는 오브젝트를 갖는 것입니다.
27+
28+
const addTwoNumbers = (start = 1) => {
29+
let n = start;
30+
31+
const api = {
32+
// API에 있는 각 함수를 실행하세요
33+
add(inc: number = 1) {
34+
n += inc;
35+
return api;
36+
},
37+
38+
print() {
39+
console.log(n);
40+
return api;
41+
},
42+
};
43+
return api;
44+
};
45+
46+
// jQuery에서 본 것처럼
47+
// 같은 스타일의 API를 허용:
48+
49+
addTwoNumbers(1).add(3).add().print().add(1);
50+
51+
// 클래스를 사용하는 비슷한 예시:
52+
53+
class AddNumbers {
54+
private n: number;
55+
56+
constructor(start = 0) {
57+
this.n = start;
58+
}
59+
60+
public add(inc = 1) {
61+
this.n = this.n + inc;
62+
return this;
63+
}
64+
65+
public print() {
66+
console.log(this.n);
67+
return this;
68+
}
69+
}
70+
71+
// 여기에서 동작:
72+
73+
new AddNumbers(2).add(3).add().print().add(1);
74+
75+
// 이 예시는 JavaScript 패턴에
76+
// 도구를 제공하는 방법을 제공하기 위해서
77+
// TypeScript 타입 추론을 사용했습니다.
78+
79+
// 더 많은 예시:
80+
//
81+
// - example:code-flow
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//// { compiler: { }, order: 1 }
2+
3+
// TypeScript는 코드를 자동으로 리팩터링하는
4+
// 도우미 로서 많은 수정 사항을 지원합니다.
5+
// 예를 들어 7번째 줄의 텍스트를 선택하고 팝업되는
6+
// 전구를 클릭하면 몇 가지 수정 사항이 제공됩니다.
7+
8+
function addOne(x: number) {
9+
return x + 1;
10+
}
11+
12+
// 이 기능은 TypeScript 3.7버전과 함께 사용할 수 있으며,
13+
// 최신 버전(nightly builds)도 포함합니다.
14+
15+
// 플레이그라운드(playground)에서 코드 샘플을 만들거나 학습할 때는
16+
// 불필요할 수도 있습니다.
17+
18+
// 그러나, 사용 가능한 수정 기능이 있다는 것은 플레이그라운드(playground)에서
19+
// 문서화할 수 있다는 것을 의미하며, 이는 매우 가치 있는 일입니다.:
20+
21+
// 예시:big-number-literals
22+
// 예시:const-to-let
23+
// 예시:infer-from-usage-changes

0 commit comments

Comments
 (0)