interface

    [Typescript] Interface (인터페이스)

    [Typescript] Interface (인터페이스)

    기본적인 사용법 interface Person { name: string; age: number; } const person: Person = { name: 'Mark', age: 35 }; function hello(p: Person): void { console.log(`안녕하세요 ${p.name}`); } optinal property 1 // 이렇게 하면 age는 있어도 되고 없어도 된다. interface Person { name: string; age?: number; } function hello(person: Person): void { console.log(`안녕하세요! ${person.name}입니다.`); } const p1: Person = { name: 'Mark', age: 35..