TypeScript/tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts

8 lines
200 B
TypeScript

// @strict: true
type Errors<T> = { [P in keyof T]: string | undefined } & {all: string | undefined};
function foo<T>() {
let obj!: Errors<T>
let x!: keyof T;
obj[x] = undefined;
}