TypeScript Version: 3.7.1-rc
Search Terms: template argument union
Code
declareclassData{string<T>(defaultValue?: string|T): string|T;}declareconststr: string|undefined;constx=newData().string(str);Expected behavior:
I'd argue string, at least that's what the user intended here.
Actual behavior:
In TypeScript version:
- 3.5,
typeof x === string - 3.6,
typeof x === unknown - 3.7,
typeof x === string|undefined
Playground Link: n/a
TypeScript Version: 3.7.1-rc
Search Terms: template argument union
Code
Expected behavior:
I'd argue
string, at least that's what the user intended here.Actual behavior:
In TypeScript version:
typeof x === stringtypeof x === unknowntypeof x === string|undefinedPlayground Link: n/a