TypeScript6 [TYPESCRIPT] GENERIC function helloBasic(message: T): T { return message; } console.log(helloBasic('Mark')); const age = helloBasic(38); TypeScript Generic 상세 설명 사이트 https://poiemaweb.com/typescript-generic TypeScript - Generic | PoiemaWeb 제네릭은 선언 시점이 아니라 생성 시점에 타입을 명시하여 하나의 타입만이 아닌 다양한 타입을 사용할 수 있도록 하는 기법이다. 한번의 선언으로 다양한 타입에 재사용이 가능하다는 장점이 poiemaweb.com 2023. 2. 8. [TYPESCRIPT] CLASS class Person { name: string; constructor(name: string) { this.name = string; } } const p1 = new Person('Mark'); console.log(p1); TypeScript Class 상세 설명 사이트 https://poiemaweb.com/typescript-class TypeScript - Class | PoiemaWeb ES6에서 새롭게 도입된 클래스는 기존 프로토타입 기반 객체지향 언어보다 클래스 기반 언어에 익숙한 개발자가 보다 빠르게 학습할 수 있는 단순명료한 새로운 문법을 제시하고 있다. 하지만 poiemaweb.com 2023. 2. 8. [TYPESCRIPT] INTERFACE 인터페이스는 일반적으로 타입 체크를 위해 사용되며 변수, 함수, 클래스에 사용 interface는 컴파일단계에서만 유효, 실제 컴파일 된 js 파일에서는 사라짐 interface Person { name: string; age: number; } function hello(person: Person): void { console.log(`안녕하세요! ${person.name} 입니다.`); } const p: Person = { name: 'Mark', age: 35 }; hello(p); // 안녕하세요! Mark 입니다. 선택적 프로퍼티와 인덱싱 가능 타입 interface Person2 { name: string; age?: number; [props: string]: any; } function .. 2023. 2. 7. [TYPESCRIPT] TYPESCRIPT COMPILER tsc typescript compiler npx tsc --init tsconfig schema http://json.schemastore.org/tsconfig 최상위 프로퍼티 compileOnSave extends compileOptions files include exclude references ... 2023. 2. 7. 이전 1 2 다음