parent
6957128341
commit
8e1cce4b8f
4 changed files with 72 additions and 0 deletions
|
@ -0,0 +1,16 @@
|
|||
//// [undefinedAssignableToGenericMappedIntersection.ts]
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
//// [undefinedAssignableToGenericMappedIntersection.js]
|
||||
"use strict";
|
||||
function foo() {
|
||||
var obj;
|
||||
var x;
|
||||
obj[x] = undefined;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
=== tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts ===
|
||||
type Errors<T> = { [P in keyof T]: string | undefined } & {all: string | undefined};
|
||||
>Errors : Symbol(Errors, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 12))
|
||||
>P : Symbol(P, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 20))
|
||||
>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 12))
|
||||
>all : Symbol(all, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 59))
|
||||
|
||||
function foo<T>() {
|
||||
>foo : Symbol(foo, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 84))
|
||||
>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 1, 13))
|
||||
|
||||
let obj!: Errors<T>
|
||||
>obj : Symbol(obj, Decl(undefinedAssignableToGenericMappedIntersection.ts, 2, 7))
|
||||
>Errors : Symbol(Errors, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 1, 13))
|
||||
|
||||
let x!: keyof T;
|
||||
>x : Symbol(x, Decl(undefinedAssignableToGenericMappedIntersection.ts, 3, 7))
|
||||
>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 1, 13))
|
||||
|
||||
obj[x] = undefined;
|
||||
>obj : Symbol(obj, Decl(undefinedAssignableToGenericMappedIntersection.ts, 2, 7))
|
||||
>x : Symbol(x, Decl(undefinedAssignableToGenericMappedIntersection.ts, 3, 7))
|
||||
>undefined : Symbol(undefined)
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
=== tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts ===
|
||||
type Errors<T> = { [P in keyof T]: string | undefined } & {all: string | undefined};
|
||||
>Errors : Errors<T>
|
||||
>all : string | undefined
|
||||
|
||||
function foo<T>() {
|
||||
>foo : <T>() => void
|
||||
|
||||
let obj!: Errors<T>
|
||||
>obj : Errors<T>
|
||||
|
||||
let x!: keyof T;
|
||||
>x : keyof T
|
||||
|
||||
obj[x] = undefined;
|
||||
>obj[x] = undefined : undefined
|
||||
>obj[x] : Errors<T>[keyof T]
|
||||
>obj : Errors<T>
|
||||
>x : keyof T
|
||||
>undefined : undefined
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// @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;
|
||||
}
|
Loading…
Reference in a new issue