Closed
Description
Repro
{
"rules": {
"@typescript-eslint/dot-notation": ["error"]
}
}
interface GameSettings {
// Known up-front properties
speed: "fast" | "medium" | "slow";
quality: "high" | "low";
// Assume anything unknown to the interface
// is a string.
[key: string]: string;
}
declare const settings: GameSettings;
// good
settings.speed;
settings.quality;
// required to satisfy noPropertyAccessFromIndexSignature, but causes a dot-notation error
settings['username'];
We should add detection for the noPropertyAccessFromIndexSignature
, and add logic so that it allows indexed access in the same cases.
This will allow you to use both this rule and the compiler option simultaneously.