ts-book
ts-book copied to clipboard
타입스크립트 교과서 소스 코드
1. 오류메시지 음영이 마지막 줄이 아닌 str = 'template 123'; 을 잘못 가리키고 있습니다. 2. 변수 음영 처리도 마지막 코드의 str에서 해야 합니다.
- myMap 타이핑은 바로 다음 절에서 나옵니다. - myMap이라는 -> myForEach라는 배열에 ~~myMap이라는~~ **_myForEach라는_** 메서드가 존재하지 않기 때문입니다,. 타이핑만 했을 뿐 ~~myMap이라는~~ **_myForEach라는_** 메서드를 구현한 적이 없습니다.
``` bind(this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; ``` https://www.typescriptlang.org/play/?ts=5.5.4#code/GYVwdgxgLglg9mABAQwCaoBTIFxhAWwCMBTAJwBpFDtE8izKIa6SLFVmDXLjP63gfVgEpEAbwBQiRKWJQQpJMkQBqKqsQQNqDcQ3AA3BIC+EiRAQBnKCnQBGRAF5bqAHSEYYTHgA2P4UZoqHYYduQATOQAzOQALOQArOQAbAGIZhZg1i7hTi7unt4gfpR2ARJB4RiRMfFJqUbmVjZBUXlBBV4Yvj6llOHlrRi1iSnCGc0use3onUUliGE1g+ixGHVjjZnZQQkzbh5dPX01cSuoCRj15U1ZLejJ+3Pdxb2LEdFxiefJGA1AA 5.5와 4.9 비교
``` class ColorThief { constructor(); getColors(image: HTMLImageElement): [number, number, number][]; getColor(image: HTMLImageElement): [number, number, number]; } interface Window { ColorThief: typeof ColorThief; } ``` 모듈X 스크립트O Window 인터페이스와 declaration merging
3.9 flat 분석하기 파트에서 만약 Depth가 22라서 인덱스 접근 타입이 undefined가 되면 어떻게 될까요? 이때는 최대한 flat한 타입이 나오게 됩니다. // type R2 = 1 | 2 | 3type R...
https://www.typescriptlang.org/docs/handbook/classes.html#parameter-properties