-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Sometimes it is desired to forbid certain types from being considered.
Example: JSON.stringify(function() {}); doesn't make sense and the chance is high it's written like this by mistake. With negated types we could eliminate a chance of it.
type Serializable = any ~ Function; // or simply ~ Function
declare interface JSON {
stringify(value: Serializable): string;
}Another example
export NonIdentifierExpression = ts.Expression ~ ts.Identifierjcalz, zheeeng, huafu, the1mills, jsamr and 121 moreRudxain, jasikpark, doeixd, yacodes, StepaZol and 3 morehaltcase, borgesius, k-tten, antonilol, Gabriel-ISS and 18 morehaltcase, lgenzelis, borgesius, k-tten, truemogician and 11 more
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript