Bug Report
π Search Terms
type narrowing based on function typeof is broken when intersection with a record is used
π Version & Regression Information
- Recent change in behaviour happened in version 4.3.5
β― Playground Link
Playground link with relevant code
π» Code
typeMeta={foo: string}interfaceF{(): string}constx=(a: (F&Meta)|string)=>{if(typeofa==="function"){// ts.version >= 4.3.5: never -- unexpected// ts.version <= 4.2.3: F & Meta -- expecteda;}else{// expected: string// ts.version >= 4.3.5: string -- expected// ts.version <= 4.2.3: string | (F & Meta) -- unexpecteda;}}π Actual behavior
behavior was half correct from in TS versions <= 4.2.3, but then it was changed in 4.3.5 which fixed the part that was wrong previously, but broke the other part that was correct. So we still have half broken behavior.
π Expected behavior
It's expected to pick the correct parts from the both versions.
Bug Report
π Search Terms
type narrowing based on function typeof is broken when intersection with a record is used
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
behavior was half correct from in TS versions <= 4.2.3, but then it was changed in 4.3.5 which fixed the part that was wrong previously, but broke the other part that was correct. So we still have half broken behavior.
π Expected behavior
It's expected to pick the correct parts from the both versions.