type alias, interface

수빈·2023년 2월 15일
0

TypeScript

목록 보기
7/7

function 표현방법

type EatType = (food:string)=> void;

interface EatInterface {
	(food:string):void;
}

Array 표현방법

type PersonList = string[];

interface IPersonList {
	[index:number]:string;
}

Intersection

interface ErrorHandling{
	success:boolean;
  	error?:{message:string};
}
interface ArtistsData{
	artists: {name:string}[];
}

type ArtistsResponseType = ArtistsData & ErrorHandling;

interface IArtistsResponse extends ArtistsData, ErrorHandling{}

let art:ArtistsResponseType;
let iar:IArtistsResponse;

Merging interface

같은 이름의 인터페이스를 여러개 만들경우, 사용할땐 하나로 합쳐진다.

0개의 댓글

관련 채용 정보