Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Labels
enhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleevaluating community engagementwe're looking for community engagement on this issue to show that this problem is widely importantpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting for team members to take a look
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/no-empty-object-type/
Description
I suggest that theno-empty-object-type
rule also disallows{}
generated by type transformations.
For example, usingOmit<V,K>
on a type that is nullable will unintentionally create a{}
type.
typeNullableData=null|{name:string;num:number};typeITS_EMPTY_OBJECT_TYPE=Omit<NullableData,'name'>;// '{}'
Fail
typeData={name:string;num:number};typeNullableData=null|Data;functiondoSomething<TextendsOmit<NullableData,'name'>// lint error>(param:T){}typeUnexpected=Omit<NullableData,'name'>;// lint error
Pass
typeData={name:string;num:number};functiondoSomething<TextendsOmit<Data,'name'>>(param:T){}typeExpected=Omit<Data,'name'>;
Additional Info
Perhaps it would be appropriate to handle this in no-unsafe-*?
Metadata
Metadata
Assignees
Labels
enhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleevaluating community engagementwe're looking for community engagement on this issue to show that this problem is widely importantpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting for team members to take a look