0
在meteor-typescript's definition file中,user.profile
对象的类型为any
。如何覆盖user.profile类型?
什么是Typescript扩展用户对象和更改配置文件类型的方法?
我试图
interface IMyUserProfile {
foo: boolean;
}
namespace Meteor {
export interface User: {
profile: IMyUserProfile
}
}
但TS只是说: “重复的标识符”。
我知道我可以直接在定义文件中更改它,但出于显而易见的原因,我宁愿不这样做。
权。这有点令人遗憾,但我真的很想在合并声明时重写。 –
那么,你可以覆盖方法(当然有不同的签名),并添加未声明的变量,这些变量应该可以回答大多数场景。在其他情况下,您需要解决它。 –