Closed
Description
Code
declare function log(msg: string): void;
type EQString<T> = T extends string ? T : never;
function c<T>(x: T | string) {
const y = x as EQString<T>; // assert stringiness
return log(y);
}
Expected behavior:
No error.
Actual behavior:
[ts]
Argument of type 'EQString<T>' is not assignable to parameter of type 'string'.
Type 'T' is not assignable to type 'string'
on y
.