Closed
Description
TypeScript Version: 2.7.0-dev.20180123
Search Terms:
Code
declare function foo(p: string): void;
function fn<T extends string | undefined, U extends string>(one: T,two: U) {
let three = Boolean() ? one : two;
foo(one!);
foo(two!);
foo(three!); // error on this line
}
Expected behavior:
No type error.
Actual behavior:
Argument of type 'string | String' is not assignable to parameter of type 'string'.
Type 'String' is not assignable to type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
This is caused by #20995. To be fair, without that change the above was not valid at all.
Playground Link:
Related Issues:
Maybe related to #21317