Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "not None" type #901

Closed
KotlinIsland opened this issue Oct 3, 2021 · 2 comments
Closed

Add a "not None" type #901

KotlinIsland opened this issue Oct 3, 2021 · 2 comments

Comments

@KotlinIsland
Copy link

I regularly find it annoying that there is no way to type something as "anything, except None".

In Kotlin the root type Any is split from null, and the union of those is denoted Any?

In TypeScript the root type unknown includes null and undefined, but those types are distinct from the other basal types object, number etc. {} can be used to refer to any type except null(and undefined)

I think a Not type would be overkill, but a handcrafted type that represents anything except None would based and useful.

@sobolevn
Copy link
Member

sobolevn commented Oct 3, 2021

Related #614

@srittau
Copy link
Collaborator

srittau commented Oct 3, 2021

#801 already suggests a general Not type. I agree that either a general Not type or a specialized NotNone type would occasionally be useful, but all discussions about new typing features should go to typing-sig.

@srittau srittau closed this as completed Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants