interface
-
[TypeScript] Interface 란?공부/TypeScript 2024. 3. 22. 14:41
Interface Ineterface는 상호 간에 정의한 약속(규칙)을 의미한다. 즉, 클래스 또는 함수 처럼 '틀'을 정의하여 타입을 강제하도록 사용할 수 있는 것이 Ineterface이다. 타입 스크립트의 Ineterface는 주로 객체 위주로 다룬다. 1. Type Alias 와 Interface 차이 //Type Alias로 지정 type Trim = { option : string } //Type Alias는 & 기호를 사용하여 객체를 합침 type Model = Trim & { name : string, color : string} let Car : Model = {name : 'Cybertruck', color : 'Silver', option : 'RangeExtender'} //inter..