unknown && false
is too loosely typed
#53352
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Bug Report
The following code should type-check: https://www.typescriptlang.org/play?#code/FAFwngDgpgBAYgQwDYGcwwLwwHYFclIwA+Mu2AJlAGYCW2U5xMVyKsJeAtgEZQBOTAAzYmAIlFMAEgBUAsgBkAggQDCAewJQAxiBprswYFTI69IqmrUAKAB4AuUtgDW2NQHdsASgeJU6AN7AMMEwfFAguHwiNjAAZLHMrFDAAL7AQA
🔎 Search Terms
unknown falsy false and &&
🕗 Version & Regression Information
Please keep and fill in the line that best applies:
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Fails to type-check
🙂 Expected behavior
Should type-check
This would be improved further if:
Falsy
could be more specific thannumber
. (Add a --strictNaNChecks option, and a NaN / integer / float type to avoid runtime NaN errors #28682)Falsy
/Truthy
were built in types.HTMLAllCollection
variant could be omitted as a legacy value sincedocument.all
is deprecated and it's otherwise the case that objects are not falsy.The text was updated successfully, but these errors were encountered: