-
-
Notifications
You must be signed in to change notification settings - Fork 671
feat: add NonNullable builtin type to remove null from type union #1875
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
Changes from 4 commits
8aa0114
9851d6c
f5a6c31
fac3fec
9810f2f
9198cf0
e9e85ae
7896091
706894c
a813892
f9790bb
c6a7092
a5cb27b
44d7b67
3142241
510d52e
a715785
4411373
a44bf8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1314,6 +1314,8 @@ declare type valueof<T extends unknown[]> = T[0]; | |
declare type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any; | ||
/** A special type evaluated to the return type of T if T is a callable function. */ | ||
declare type returnof<T extends (...args: any) => any> = ReturnType<T>; | ||
/** A special type that excludes null and undefined from T. */ | ||
declare type NonNullable<T> = T extends null | undefined ? never : T; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, how does this work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heh, toyed around with it a little and it works, I just don't understand how There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a conditional type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My guess is that this somehow decomposes |
||
|
||
/** Pseudo-class representing the backing class of integer types. */ | ||
declare class _Integer { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"asc_flags": [ | ||
] | ||
} | ||
dcodeIO marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.