typescript-kr / typescript-kr.github.io Goto Github PK
View Code? Open in Web Editor NEW๐ฐ๐ท TypeScript Handbook in Korean
Home Page: https://typescript-kr.github.io
License: MIT License
๐ฐ๐ท TypeScript Handbook in Korean
Home Page: https://typescript-kr.github.io
License: MIT License
์์ ์๋ฃ ๋ ์ง: 2020/05/17
๋ฒ์ญ ๋ฒ์:
Breaking Changes
์์ ์๋ฃ ๋ ์ง:
๋ฒ์ญ ๋ฒ์:
x[3] = "world"; // ์ข์์, 'string'์ 'string | number'์ ํ ๋น๋ ์ ์์ต๋๋ค.
์ด ๋ถ๋ถ์ ์๋ฌธ์
x[3] = "world"; // Error, Property '3' does not exist on type '[string, number]'
์ด๊ธฐ์, ํ ๋น๋ ์ ์๋ค๊ณ ๋งํจ์ด ์ณ์ต๋๋ค.
๊ทธ ์ธ์๋
console.log(x[5].toString()); // ์ข์์, 'string' ๋ฐ 'number'์ ๋ชจ๋ 'toString'์ด ์์ต๋๋ค.
๋ฒ์ญ์ ์๋ฌธ์
console.log(x[5].toString()); // Error, Property '5' does not exist on type '[string, number]'.
์ด๊ธฐ์, 5๋ฒ ์ธ๋ฑ์ค๊ฐ ์๊ณ , ํด๋น ์ธ๋ฑ์ค๊ฐ undefined
์ด๋ฏ๋ก toString()
์ ์ธ ์ ์๋ค๊ณ ๋ฒ์ญํจ์ด ๋ ๋์ ๋ฏ ์ถ์ต๋๋ค.
ํ์ผ ๊ฒฝ๋ก ๋๋ ๋งํฌ: ์๋ฌธ
์์ ์๋ฃ ๋ ์ง: 2020/05/17
๋ฒ์ญ ๋ฒ์:
Improvements in Inference and Promise.all
Speed Improvements
์์ ์๋ฃ ๋ ์ง:
๋ฒ์ญ ๋ฒ์:
์์ ์๋ฃ ๋ ์ง:
๋ฒ์ญ ๋ฒ์:
Gulp 4.0 ๋ฒ์ ์ด ๊ธฐ๋ณธ ์ค์น ๋ฒ์ ์ผ๋ก ๋ณ๊ฒฝ๋์ด
์ค์ต ์ฝ๋์ ์๋ด๋ฅผ ์ถ๊ฐํด์ฃผ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var tsify = require('tsify');
var paths = {
pages: ['src/*.html']
};
gulp.task('copy-html', function () {
return gulp.src(paths.pages)
.pipe(gulp.dest('dist'));
});
gulp.task('default', gulp.series(gulp.parallel('copy-html'), function () {
return browserify({
basedir: '.',
debug: true,
entries: ['src/main.ts'],
cache: {},
packageCache: {}
})
.plugin(tsify)
.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('dist'));
}));
Watchify ์ค์ต
npm install --save-dev watchify fancy-log
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var watchify = require('watchify');
var tsify = require('tsify');
var fancy_log = require('fancy-log');
var paths = {
pages: ['src/*.html']
};
var watchedBrowserify = watchify(browserify({
basedir: '.',
debug: true,
entries: ['src/main.ts'],
cache: {},
packageCache: {}
}).plugin(tsify));
gulp.task('copy-html', function () {
return gulp.src(paths.pages)
.pipe(gulp.dest('dist'));
});
function bundle() {
return watchedBrowserify
.bundle()
.on('error', fancy_log)
.pipe(source('bundle.js'))
.pipe(gulp.dest('dist'));
}
gulp.task('default', gulp.series(gulp.parallel('copy-html'), bundle));
watchedBrowserify.on('update', bundle);
watchedBrowserify.on('log', fancy_log);
์์ ์๋ฃ ๋ ์ง:
๋ฒ์ญ ๋ฒ์:
#92 ์ด์์์
๋งํฌ์ %20
์ด ๋ค์ด๊ฐ ์์ผ๋ฉด gitbook ๋น๋์ html ํ์ผ์์ ์ ์์ ์ผ๋ก ๋งํฌ๊ฐ ๊ฑธ๋ฆฌ์ง ์๋ ์ค๋ฅ๊ฐ ์์ต๋๋ค.
๋งํฌ ์ค๋ฅ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ๋ฒ์ญ ํ์ผ ์ด๋ฆ ๋ช
์ ์ ๋ถ ์ผ๋ฐฅ์ผ์ด์ค๋ก ๋ณ๊ฒฝํ๋ ์์
์ ์งํํฉ๋๋ค.
-
์ผ๋ก ์ฌ์ฉํ์
์ถ๋ก (Inferring the types)
์๋ฅผ ๋ค์ด TypeScript ์ปดํ์ผ๋ฌ๋ ํ์ชฝ์๋ ํ์
์ด ์์ง๋ง ๋ค๋ฅธ ํ์ชฝ์ ํ์
์ด ์๋ ๊ฒฝ์ฐ ๊ทธ ํ์
์ ์ดํดํ ์ ์๋ค๋ ๊ฒ์ ์๊ฒ ๋ฉ๋๋ค:
์ด๊ฒ์ ํ์
์ถ๋ก ์ ํ ์ข
๋ฅ์ธ "์ํฉ์ ํ์ดํ(Contextual Typing)"์ด๋ผ๊ณ ํฉ๋๋ค. ์ด๋ฅผ ํตํด ํ๋ก๊ทธ๋จ์ ๊ณ์ ์ ์งํ๋ ๋ฐ ๋๋ ๋
ธ๋ ฅ์ ์ค์ผ ์ ์์ต๋๋ค.
->
์์ ๋ฅผ ์คํํด๋ณด๋ฉด, ๋์
๋ฌธ(i.e assign)์ ํ์ชฝ์๋ง ํ์
์ด ์๋๋ผ๋ TypeScript ์ปดํ์ผ๋ฌ๊ฐ ํ์
์ ์ดํดํ ์ ์๋ค๋ ๊ฒ์ ์๊ฒ ๋ ๊ฒ๋๋ค:
์ด๊ฒ์ ํ์
์ถ๋ก ์ ํ ์ข
๋ฅ์ธ "์ํฉ์ ํ์ดํ(Contextual Typing)"์ด๋ผ๊ณ ํฉ๋๋ค. ์ด๋ฅผ ํตํด ํ๋ก๊ทธ๋จ์ ํ์ดํํ๋ ๋ฐ ๋๋ ๋
ธ๋ ฅ์ ์ค์ผ ์ ์์ต๋๋ค.
์๋ฌธ
In playing with the example, you may notice that the TypeScript compiler can figure out the type even if you only have types on one side of the equation:
This is called โcontextual typingโ, a form of type inference. This helps cut down on the amount of effort to keep your program typed.
๊ธฐ์ฌ ๋ฐฉ๋ฒ ๋ฌธ์ ๋ณด์ ์์
๊ธฐ์กด์ ๊ณ ๊ธ ํ์ ์ ๊ฐ์ด ์์ ๋ฐ ๋ฒ์ญ ํ์
๋ค์๊ธ๋ก ๋์ด๊ฐ๋ ๋ฒํผ๊ณผ Fork me github ์ด๋ฏธ์ง๋ ๊ฒน์น๋ ๋ถ๋ถ์ด์์ด์
github์ผ๋ก ๋์ด์ฌ๋ คํ๋๋ฐ ๋ค์ํ์ด์ง๋ก ๋์ด๊ฐ์ ์ฒ์์๋ ์ค๋ฅ์ธ์ค์์์ต๋๋ค.
์์ ๋๋ฉด ์ข์๊ฒ๊ฐ์ต๋๋ค
์ฝ์๋ ์์ ์ด ๋ง๋์ง ํ์ธ
์์ ์๋ฃ ๋ ์ง:
๋ฒ์ญ ๋ฒ์:
์๋ ํ์ธ์.
typescript-kr.github.io / pages / tutorials / React & Webpack.md
์ ํ์ผ์์ ๋ผ์ธ 87์ ์๋ __์ ์ด๋ค.__๋ฅผ __์ ๋๋ค.__๋ก ์คํ ์์ ์์ฒญ๋๋ฆฝ๋๋ค.
๋ค๋ฆ์ด ์๋๋ผ ๋ฒ์ญ๋ณธ์ ์ ์ฝ๊ณ ์๋๋ฐ, ํ์ด์ง๋ด ๊ฝค ๋ง์ ๋ด๋ถ๋งํฌ๊ฐ ๊นจ์ ธ์๋๋ผ๊ณ ์.
ํ์ผ ์ด๋ฆ ์คํ๋ ์ข ์์๊ณ ... ๊ทธ๋ฆฌ๊ณ ๊ฒฐ์ ์ ์ผ๋ก
๋งํฌ๋ฅผ ๋ณด๋ฉด *.md๋ก ๋๋๋๋ฐ, ๋งํฌ ์ฃผ์๋ฅผ *.html๋ก ํด์ผ ํฌ๋กฌ ๋ธ๋ผ์ฐ์ ๋ด์์ ์ด๋์ด ๊ฐ๋ฅํฉ๋๋ค.
์ด๊ฒ ๋น๋ ๊ณผ์ ์์ ์๋ ๋ณํ์์ผ์ฃผ๋ ๊ฑด๋ฐ, ์๋๋ ๊ฑด์ง, ์๋๋ฉด ๊ทธ๋ฅ ๋งํฌ๋ค์ด ๋ฌธ์ ์์ฑ๊ณผ์ ์์ ๋์จ ์คํ์ธ์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
๋ค๋ง, ํฌํฌํด์ npx gitbook serve ํด๋ณด๋๊น ๋ก์ปฌ์์๋ ๋งํฌ๋ ๋ค ๊นจ์ ธ์๋๋ผ๊ณ ์. ํํํ
๊ทธ๋ฆฌ๊ณ ๊น๋ถ ํจํค์ง๋ ์ต์ ๋ฒ์ ผ? (3.2.3) ๋ฒ์ ผ์ผ๋ก ์ค์นํ๋๊น ์ค๊ดํธ ๋๊ฐ ์ฐ์์ ํ์ฑ ์ค๋ฅ๊ฐ ๋๋๋ผ๊ณ ์.
๋งํฌ ์ค๋ฅ๊ฐ ์คํ๋ฉด ์ ๊ฐ ๋๋๋๋ก ๊นจ์ง ๋ถ๋ถ ์์ ํด์ ํ์์ฒญ์ ๋ ๋ฆด๊น ํฉ๋๋ค. .
yeonjuan/TypeScript-Handbook-ko ํ๋ก์ ํธ๋ฅผ Deprecated ์ํค๊ณ , ์ด ํ๋ก์ ํธ๋ก ๋ง์ด๊ทธ๋ ์ด์ ํ๊ธฐ๋ก ํ์์ต๋๋ค.( Deprecated ๊ณํ ์ฐธ๊ณ )
์๋ ๋๊ธ๋ก ํ๋ก์ ํธ ๋ง์ด๊ทธ๋ ์ด์ ์ ํ์ํ ์์ , ์๊ฒฌ์ ๋ํด ๋จ๊ฒจ์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค.
ํธ์์ yeonjuan/TypeScript-Handbook-ko ํ๋ก์ ํธ๋ฅผ ์ด์ ํ๋ก์ ํธ ๋ผ๊ณ ๋ถ๋ฅด๊ฒ ์ต๋๋ค.
์์ ์๋ฃ ๋ ์ง: 2020/05/17
๋ฒ์ญ ๋ฒ์:
// @ts-expect-error Comments
Uncalled Function Checks in Conditional Expressions
let result1 = buildName("Bob"); // ์ฌ๋ฐ๋ฅด๊ฒ ๋์, "Bod Smith" ๋ฐํ
Bod
-> Bob
๋ฒ์ญ ๊ด๋ จ ์์ ์งํ ์ํฉ์ ๊ณต์ ๋ฐ ๊ด๋ฆฌํ ๋ฐฉ๋ฒ์ ์ ํด์ผ ํ ๊ฒ ๊ฐ์ต๋๋ค.
progress.md
ํ์ผ๋ก ์งํ ์ํฉ ๊ด๋ฆฌ3๊ฐ์ง ์ ๋ ์ ํ์ง๊ฐ ์๋๋ฐ ์๊ฒฌ ์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค :)
์์ ์๋ฃ ๋ ์ง:
๋ฒ์ญ ๋ฒ์:
์์ ์๋ฃ ๋ ์ง:
๋ฒ์ญ ๋ฒ์:
์์ ์๋ฃ ๋ ์ง: X
๋ฒ์ญ ๋ฒ์: X
์์ ์๋ฃ ๋ ์ง: 2020/05/17
๋ฒ์ญ ๋ฒ์:
Editor Improvements
๋ฒ์ญ ๊ท์น ํตํฉ ๋ฐ ์ ๋ฆฌ
Advanced Type / Nullable ํ์ด์ง๋ฅผ ์ฝ๋ค๊ฐ ์ผ๋ฐ ๋ณ์์ null ์ด๋ undefined ๋ฅผ ๋ช ์์ ์ผ๋ก ์ ์ด์ฃผ์ง์์ผ๋ฉด ์๋๋ค๊ณ ํ๋๋ฐ ๋ง์ ํ์ดํํ๊ณ ์ปค๋งจ๋๋ฅผ ์คํํ๋๊น ์๋์ ๊ฐ์ ๊ฒฐ๊ณผ๊ฐ ๋์ค๋๋ฐ ๋ญ๊ฐ ์๋ชป ์ดํดํ๊ฑธ๊น์?
let s = "foo"
s = null // console.log(s) -> null
s = undefined // console.log(s) -> undefined
ํ์ผ ๊ฒฝ๋ก ๋๋ ๋งํฌ: https://typescript-kr.github.io/pages/basic-types.html
๋ด์ฉ: Null and Undefined
์ ์ note ๋ถ๋ถ์ ํค์๋ ์คํ๊ฐ ์์ต๋๋ค.
structNullChecks
-> strictNullChecks
์ง์ PR ํ์๊ฒ ์ต๋๊น? (O/X): O
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.