企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
>[success] # 类作为类型 ~~~ 1.类也可以声明一个类型和接口类型一样的效果 ~~~ ~~~ class A { name: string; constructor(name: string) { this.name = name; } } const a1: A = {}; // ts(2741) Property 'name' is missing in type '{}' but required in type 'A'. const a2: A = { name: 'a2' }; // ok ~~~