Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I havesearched for related issues and found none that match my proposal.
- I have searched thecurrent rule list and found no rules that match my proposal.
- I haveread the FAQ and my problem is not listed.
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Link to the rule's documentation
https://typescript-eslint.io/rules/ban-types/
Description
Filing this issue as a followup/superset of the more targeted#8697. As ofmicrosoft/TypeScript#49119, TypeScript has much better handling of{}
semantics than it did when theban-types
default options were written.@RyanCavanaugh -the dev lead for TypeScript- called out inmicrosoft/TypeScript#57735 (comment) that as it stands today,{ }
is a valid type with a valid meaning in TypeScript.
Proposal: let's re-think the default options inban-types
to agree with the way TypeScript now works?
My first proposal would be, roughly...
- Remove any bans of
{}
altogether, including inrecommended
andstrict
- Add a ban on
NonNullable<unknown>
that suggests switching to{}
...but I'd want to hear from@bradzacher and@RyanCavanaugh on whether that satisfies the intents of both TypeScript andban-types
.
Fail
letnonNullish:Object;
Pass
letnonNullish:{};
Additional Info
For clarity, the intent of the two issues I'm filing are:
- This one: holistically rethinking
ban-types
, which might take some time - Enhancement: [ban-types] Allow {} in the recommended config #8697: spot improving the
recommended
experience, which can land first
If this issue is resolved before#8697, that's great too.