tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts(5,5): error TS2322: Type 'undefined' is not assignable to type 'Errors<T>[keyof T]'.
==== tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts (1 errors) ====
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;
~~~~~~
!!! error TS2322: Type 'undefined' is not assignable to type 'Errors<T>[keyof T]'.
}
|