Structual Type System
-
TypeSystemProgramming/JavaScript & TypeScript 2022. 2. 16. 15:51
타입스크립트의 타입 체계를 이해하는데 도움이 된다. 타입스크립트는 Structual Type System을 따른다. Structual Type System 구조가 같으면 같은 타입이다. interface IPerson { name:string; age:number; speak():string; }; type PersonType = { name:string; age:number; speak():string }; let personInterface : IPerson = {} as any; let personType : PersonType = {} as any; // 같은 구조니까 대입 가능 personInterface = personType personType = personInterface Nominal ..