본문 바로가기

TypeScript3

타입스크립트 : 타입의 함정 (Read와 Write의 타입추론) 평화롭게 코딩을 하던 어느날.Nest.js 톡방의 "주발자"라는 분께서 한 가지 의문을 던져주셨다.바로 다음 코드에서 obj2[key] = value;  코드를 적어 놓을테니 해보실 분들은 해보시길 바랍니다.type Entries2 = { [K in keyof T]-?: [K, T[K]];}[keyof T][];interface Test { test1: string; id?: number;}const obj: Test = { test1: "hoi", id: 0,};const obj2: Test = { test1: "", id: undefined,};type A = Entries2;for (const arr of Object.entries(obj) as Entries2) { const [ke.. 2024. 6. 23.
타입챌린지 : 7-Readonly (easy) 이 글은 제가 타입챌린지를 하면서 해석한 내용을 적는 글입니다. 틀린 내용이 있으면 댓글 달아주시면 감사하겠습니다. https://github.com/type-challenges/type-challenges/blob/main/questions/00007-easy-readonly/README.md GitHub - type-challenges/type-challenges: Collection of TypeScript type challenges with online judge Collection of TypeScript type challenges with online judge - GitHub - type-challenges/type-challenges: Collection of TypeScript typ.. 2023. 3. 1.
타입챌린지 : 4-Pick (easy) 이 글은 제가 타입챌린지를 하면서 해석한 내용을 적는 글입니다. 틀린 내용이 있으면 댓글 달아주시면 감사하겠습니다. https://github.com/type-challenges/type-challenges/blob/main/questions/00004-easy-pick/README.md GitHub - type-challenges/type-challenges: Collection of TypeScript type challenges with online judge Collection of TypeScript type challenges with online judge - GitHub - type-challenges/type-challenges: Collection of TypeScript type ch.. 2023. 2. 28.