我正在尝试如何定义其他可选属性。isAnotherProperty'; // This is the bit I cannot figure out
isAnotherProperty: boolean = false;
使用上面的TypeScript引发一个错误:
Property '[OptionalProps]' in type 'EntityA' is not assignable to the same
目前,我正在将JavaScript模块迁移到TypeScript,并且在强键入具有可选属性的对象时会遇到问题。我找到了一种打开模态的方法。该方法只有一个参数,它是模态的不同选项的映射,并且都是可选的。openConfirmDialog({text : "are you sure ?"})迁移到TypeScript后,我声明了一个类,它表示所有这些不同的选项:
text