Closed
Description
TypeScript Version: 3.7.1-rc
Search Terms: template argument union
Code
declare class Data {
string<T>(defaultValue?: string|T): string|T;
}
declare const str: string|undefined;
const x = new Data().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