Closed as not planned
Description
Suggestion
π Search Terms
Negated types
β Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
β Suggestion
Many typescript users want the ability to negate types
type NotStr = not string;
At present, typescript does not have real negative types, but if negative types can be applied in some actual development scenarios, it will be able to express types more clearly and directly. I think this is the basic function that a Type system should have. Without this function, developers may use some imprecise and complex ways to implement flexibly, which is not good
I've seen a PR that was turned off, which is a real shame
#29317
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment