【发布时间】:2022-10-04 21:06:47
【问题描述】:
多年来我一直使用以下代码
export interface User {
readonly name: User.Name;
readonly address: User.Address;
}
export namespace User {
export interface Name {
readonly first: string;
readonly last: string;
}
export interface Address {
readonly country: string;
readonly city: string;
}
}
我喜欢通过User 接口访问的Name 和Address 接口,这有助于防止名称冲突、显示关系等。
现在,我和 ESLint 规则斗争了@typescript-eslint/no-namespace
是否可以在不违反规则的情况下实现相同的打字?
【问题讨论】:
标签: typescript eslint typing typescript-eslint