We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#25947
keyof
string
[x: string]: SomeType
ReadonlyArray
readonly
Could write
all<T extends unknown[]>(...args: T): Promise<{ [K in keyof T]: Unpromise<T[K]> }>;
Interesting to note: Unpromise is like awaited.
Unpromise
awaited
null
undefined
#24193
We don't consider null or undefined as discriminators
Yes we do, we just don't narrow them from properties on object types since they're not unit types.
What you need to know is that these types have disjoint domains.
Might add some complexity to the control flow analyzer.
What about in the following case?
type ErrorOrSuccess<T> = | { value: null, message: string } | { value: T };
T
Conclusion: let's try this!
unknown
in
So you can force something like
if (x && typeof x.a === "string" && /*...*/)
The text was updated successfully, but these errors were encountered:
Wrong date in the title?
Sorry, something went wrong.
Nope, we just forgot to post the notes when it happened
No branches or pull requests
Mapped tuple types
#25947
keyof
.string
in the presence of a string index signature like[x: string]: SomeType
.*
ReadonlyArray
?readonly
from a mapped type mean operating on a tuple type.readonly
doesn't apply to tuple element fields?readonly
."Could write
Interesting to note:
Unpromise
is likeawaited
.null
/undefined
as discriminators#24193
We don't consider
null
orundefined
as discriminatorsYes we do, we just don't narrow them from properties on object types since they're not unit types.
What you need to know is that these types have disjoint domains.
Might add some complexity to the control flow analyzer.
What about in the following case?
T
could benull
at runtime.Conclusion: let's try this!
Narrowing
unknown
in
).in
can potentially throw if the right side isnull
/undefined
So you can force something like
The text was updated successfully, but these errors were encountered: