TypeScript


TypeScript 动态创建类

### 首先定义一个Greeter的类 ``` class Greeter { greeting: string; constructor(message: string) { this.greeting = message; } greet() { return "Hello, " + this.greeting; } } ``` ### 根据字符串动态创建Greeter类 ``` //instance creation here var greeter = Object....

  • 1