Closed
Description
TypeScript Version: 3.5.0-dev.20190424
Code
function f<
TType extends { p: string },
>(
bla: TType
): void {
const x: TType['p'] = 'test'; // typechecks
const y: TType["p"] extends string ? string : number = "test"; // does not
}
Expected behavior:
It typechecks.
Actual behavior:
It does not:
Type '"test"' is not assignable to type 'TType["p"] extends string ? string : number'.
const y: TType["p"] extends string ? string : number
The assignment to x
however typechecks.