-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Boolean properties are treated differently in conditional types (functions/methods) #48696
Comments
const testClassFails = new TestClass<FailType>();
const failParam = { foo: false }; // Step between!
const resultFails = testClassFails.testFunc(failParam);
resultFails.testProp='yes'; Interesting enough this works! the "typeof" used in the function seems to be slightly different... |
|
Thank you for the explanation! This is not intuitive tho. But i assume there is good reason to be as it is? Especially since when i assign the object literal to a variable before it does indeed work. |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Bug Report
Comparing conditional types containing boolean properties behave dififferent to other property types. But this only occures when the comparison takes place in a function/method.
🔎 Search Terms
conditional types, boolean, method, function
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
The type of resultFails.testProp is not 'yes'
🙂 Expected behavior
The type of resultFails.testProp should be 'yes'
The text was updated successfully, but these errors were encountered: