Skip to content

Commit 70c7728

Browse files
authored
class property type first commit (typescript-kr#181)
1 parent bfdc387 commit 70c7728

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

โ€Žpages/release-notes/typescript-4.0.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,14 @@ function foo(x: [first: string, second: number]) {
272272

273273
๋” ์•Œ๊ณ  ์‹ถ์œผ์‹œ๋ฉด, ๋ผ๋ฒจ๋ง๋œ ํŠœํ”Œ ์š”์†Œ์— ๋Œ€ํ•œ [ํ’€ ๋ฆฌํ€˜์ŠคํŠธ](https://github.com/microsoft/TypeScript/pull/38234)๋ฅผ ํ™•์ธํ•ด๋ณด์„ธ์š”
274274

275-
## Class Property Inference from Constructors
275+
## ์ƒ์„ฑ์ž๋กœ๋ถ€ํ„ฐ ํด๋ž˜์Šค ํ”„๋กœํผํ‹ฐ ํƒ€์ž… ์ถ”๋ก ํ•˜๊ธฐ (Class Property Inference from Constructors)
276276

277-
TypeScript 4.0 can now use control flow analysis to determine the types of properties in classes when `noImplicitAny` is enabled.
277+
TypeScript 4.0์—์„œ๋Š” `noImplicitAny`๊ฐ€ ํ™œ์„ฑํ™”๋˜์—ˆ์„ ๋•Œ ํด๋ž˜์Šค ๋‚ด์˜ ํ”„๋กœํผํ‹ฐ ํƒ€์ž…์„ ๊ฒฐ์ •ํ•˜๊ธฐ ์œ„ํ•ด ์ œ์–ด ํ๋ฆ„ ๋ถ„์„์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
278278

279279
<!--prettier-ignore -->
280280
```ts
281281
class Square {
282-
// Previously both of these were any
282+
// ์ด์ „์— any๋กœ ์ถ”๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.
283283
area;
284284
// ^?
285285
sideLength;
@@ -291,7 +291,7 @@ class Square {
291291
}
292292
```
293293

294-
In cases where not all paths of a constructor assign to an instance member, the property is considered to potentially be `undefined`.
294+
์ƒ์„ฑ์ž์˜ ๋ชจ๋“  ๊ฒฝ๋กœ๊ฐ€ ์ธ์Šคํ„ด์Šค ๋ฉค๋ฒ„์— ํ• ๋‹นํ•œ ๊ฒƒ์ด ์•„๋‹ ๊ฒฝ์šฐ, ํ”„๋กœํผํ‹ฐ๋Š” ์ž ์žฌ์ ์œผ๋กœ `undefined`๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.
295295

296296
<!--prettier-ignore -->
297297
```ts
@@ -312,15 +312,15 @@ class Square {
312312
}
313313
```
314314

315-
In cases where you know better (e.g. you have an `initialize` method of some sort), you'll still need an explicit type annotation along with a definite assignment assertion (`!`) if you're in `strictPropertyInitialization`.
315+
๋” ๋งŽ์€ ๋‚ด์šฉ์ด ์žˆ๋Š” ๊ฒฝ์šฐ(e.g. `initialize` ๋ฉ”์„œ๋“œ ๋“ฑ์ด ์žˆ๋Š” ๊ฒฝ์šฐ), `strictPropertyInitialization` ๋ชจ๋“œ์—์„œ๋Š” ํ™•์ •์  ํ• ๋‹น ๋‹จ์–ธ(`!`)์— ๋”ฐ๋ผ ๋ช…์‹œ์ ์œผ๋กœ ํƒ€์ž…์„ ์„ ์–ธํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
316316

317317
```ts
318318
class Square {
319-
// definite assignment assertion
319+
// ํ™•์ •์  ํ• ๋‹น ๋‹จ์–ธ
320320
// v
321321
sideLength!: number;
322322
// ^^^^^^^^
323-
// type annotation
323+
// ํƒ€์ž… ํ‘œ๊ธฐ
324324

325325
constructor(sideLength: number) {
326326
this.initialize(sideLength);
@@ -336,7 +336,7 @@ class Square {
336336
}
337337
```
338338

339-
For more details, [see the implementing pull request](https://github.com/microsoft/TypeScript/pull/379200).
339+
๋” ์ž์„ธํžˆ ์•Œ๊ณ  ์‹ถ๋‹ค๋ฉด, [์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋Š” Pull Request๋ฅผ ๋ณด์„ธ์š”](https://github.com/microsoft/TypeScript/pull/379200).
340340

341341
## Short-Circuiting Assignment Operators
342342

0 commit comments

Comments
ย (0)