確認環境
"typescript": "3.0.3"
TypeScriptコード
// 匿名クラスのインスタンス化
const inner = new class {
/**
* 匿名クラスのメソッド
*/
public hello(name: string): void {
// ログ出力
console.log(`hello, ${name}`);
}
}
// 実行
inner.hello(`Jon`);
コンソール出力
hello, Jon