Artificial intelligent assistant

TypeScript オブジェクトに関数を含む場合の型定義方法 TypeScript // var Penguin = { name: '', }; // var Falcon = { name: '', fly: function(){ console.log(this.name + ''); } }; Falcon.fly(); // ' // const Penguin : { name: string; } = { name: '', }; // const Falcon : { name: string; fly: any; } = { name: '', fly: function(): void{ console.log(this.name + ''); } }; Falcon.fly(); // ' ### <

- TypeScript Deep Dive #
<

`() => ` void `() => void`


//
const Falcon : {
name: string;
fly: () => void;
} = {
name: '',
fly: function(): void {
console.log(this.name + '');
}
};

Falcon.fly(); // '


TS Playground

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 8ec390de8a2939ac57484deb5a13cc01