You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constrequiredArgFn=(value: string)=>valueconstoptionalArgFn=(value?: string)=>{if(Boolean(value)){requiredArgFn(value)// Error: Type 'undefined' is not assignable to type 'string'.(2345)}if(!!value){requiredArgFn(value)// No error, type of value is 'string'}}
🙁 Actual behavior
Conditional checks with Boolean(value) do not cause the value type to be non-nullable and non-false, as a double negation does (!!value).
🙂 Expected behavior
Conditional checks with Boolean(value) should cause the value type to be non-nullable and non-false, as a double negation does (!!value).
Since the result of calling Boolean(someValue) is always equal to the result of calling !!someValue.
The text was updated successfully, but these errors were encountered:
Bug Report
Boolean output type
,Boolean() infer
🔎 Search Terms
Boolean infer
,Boolean condition
🕗 Version & Regression Information
Tested on latest version 4.6.2, but has the same behavior even back to 3.5.1.
Nightly version (4.7.0-dev.20220505) has the same behaviour.
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Conditional checks with
Boolean(value)
do not cause the value type to be non-nullable and non-false, as a double negation does (!!value
).🙂 Expected behavior
Conditional checks with
Boolean(value)
should cause the value type to be non-nullable and non-false, as a double negation does (!!value
).Since the result of calling
Boolean(someValue)
is always equal to the result of calling!!someValue
.The text was updated successfully, but these errors were encountered: