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
conditional guard, conditional flow
Playground link with relevant code
type PackageForFunctions<T> = T extends Function ? (required: true) => T : T; const getOriginal = <T>(value: PackageForFunctions<T>): T => { if (typeof value === 'function') return value(false); return value; };
value(false)
value
(required: true) => T
not assignable to type 'T'
T
true
The text was updated successfully, but these errors were encountered:
Duplicate of #33912
Sorry, something went wrong.
Emit comments for each node in a node list (microsoft:microsoft#45766)
95bd539
64fc3b2
No branches or pull requests
Bug Report
π Search Terms
conditional guard, conditional flow
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
value(false)
. Wrong forvalue
can only be a function when it is(required: true) => T
.not assignable to type 'T'
" in the last return. Wrong forvalue
must beT
if it is not a function.π Expected behavior
true
onvalue(false)
.T
at that line.The text was updated successfully, but these errors were encountered: