任意属性那个章节的运行效果和教程不同

作者: suzhenghui-sky创建于 2022年2月9日更新于 2022年2月9日

https://ts.xcatliu.com/basics/type-of-object-interfaces.html interface Person { name: string; age?: number; } let tom: Person = { name: 'Tom', age: 25, gender: 'male' }; 我运行了,没有报错。ts 编译器版本:Version 4.5.5

内容来源: xcatliu/typescript-tutorial