启用 tslint/eslint 规则 TS2339(属性“x”在类型“y”上不存在)

anA*_*ent 12 typescript tsc eslint

虽然我能找到的每个主题都想要修复或禁用 TS2339 错误,但我正在尝试使 eslint 规则与 typescript 规则同步,并且我想启用它。

在查看typescript-eslint项目时,我似乎找不到如何启用 TS2339 规则或找到关联的名称。

你可以看到我正在尝试做的设置:Typescript PlayGround

type Person = {
    name: string;
}

const me: Person = {
    name: 'Kenny'
}

// this should error both in the IDE (which it does) and with eslint command line with the @typescript-eslint configuration (which it does NOT)
me.age = 3

Run Code Online (Sandbox Code Playgroud)

遵循此处的设置和配置:规则设置

type Person = {
    name: string;
}

const me: Person = {
    name: 'Kenny'
}

// this should error both in the IDE (which it does) and with eslint command line with the @typescript-eslint configuration (which it does NOT)
me.age = 3

Run Code Online (Sandbox Code Playgroud)