typescript-eslint: Bug: ban-types renames locally shadowed builtin uppercase type
Before You File a Bug Report Please Confirm You Have Done The Following…
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
type StringToUnion<String extends string> = String extends `${infer Letter}${infer Rest}`
? Letter | StringToUnion<Rest>
: never;
ESLint Config
module.exports = {
"parser": "@typescript-eslint/parser",
"rules": {
"@typescript-eslint/ban-types": "error"
}
};
tsconfig
{
"compilerOptions": {
// ...
}
}
Expected Result
The rule does not return an error and does not change String in String extends `${infer Letter}${infer Rest} to string when --fix is used.
Actual Result
eslint returns:
error Don't use `String` as a type. Use string instead @typescript-eslint/ban-types
Additional Info
No response
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (12 by maintainers)
Ban types is deprecated and it’s replacement has scope analysis to support this. Closing as fixed.
I would suggest looking at TS’s own types:
Sindre often “does his own thing”, and the popularity of
type-festlargely comes from the fact that it’s “a Sindre package”, but other libraries likets-toolbeltandutility-typesall adopt the short identifiers convention. But anyway, that’s definitely off-topic.