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
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
This is the behavior in every version I tried, and I reviewed the FAQ
typeFailsType={foo: boolean;};typeWorksType={foo: string};classTestClass<Param>{testFunc: <TextendsPartial<Param>>(param: T)=>{testProp?:ParamextendsPartial<T> ? 'yes' : 'no'}=(param)=>({});}typeinlineTest=FailsTypeextendsPartial<FailsType> ? 'yes' : 'no';constinlineTestValue:inlineTest='yes';// Here i use the Works TypeconsttestClassWorks=newTestClass<WorksType>();constresultWorks=testClassWorks.testFunc({foo: 'works'});resultWorks.testProp='yes';// Here i use the Fails TypeconsttestClassFails=newTestClass<FailsType>();constresultFails=testClassFails.testFunc({foo: false});resultFails.testProp='yes';
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'