Skip to content

Commit 8e1cce4

Browse files
authored
Add regression test for #25485 as it is already fixed (#27320)
1 parent 6957128 commit 8e1cce4

4 files changed

+72
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//// [undefinedAssignableToGenericMappedIntersection.ts]
2+
type Errors<T> = { [P in keyof T]: string | undefined } & {all: string | undefined};
3+
function foo<T>() {
4+
let obj!: Errors<T>
5+
let x!: keyof T;
6+
obj[x] = undefined;
7+
}
8+
9+
10+
//// [undefinedAssignableToGenericMappedIntersection.js]
11+
"use strict";
12+
function foo() {
13+
var obj;
14+
var x;
15+
obj[x] = undefined;
16+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
=== tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts ===
2+
type Errors<T> = { [P in keyof T]: string | undefined } & {all: string | undefined};
3+
>Errors : Symbol(Errors, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 0))
4+
>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 12))
5+
>P : Symbol(P, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 20))
6+
>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 12))
7+
>all : Symbol(all, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 59))
8+
9+
function foo<T>() {
10+
>foo : Symbol(foo, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 84))
11+
>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 1, 13))
12+
13+
let obj!: Errors<T>
14+
>obj : Symbol(obj, Decl(undefinedAssignableToGenericMappedIntersection.ts, 2, 7))
15+
>Errors : Symbol(Errors, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 0))
16+
>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 1, 13))
17+
18+
let x!: keyof T;
19+
>x : Symbol(x, Decl(undefinedAssignableToGenericMappedIntersection.ts, 3, 7))
20+
>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 1, 13))
21+
22+
obj[x] = undefined;
23+
>obj : Symbol(obj, Decl(undefinedAssignableToGenericMappedIntersection.ts, 2, 7))
24+
>x : Symbol(x, Decl(undefinedAssignableToGenericMappedIntersection.ts, 3, 7))
25+
>undefined : Symbol(undefined)
26+
}
27+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
=== tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts ===
2+
type Errors<T> = { [P in keyof T]: string | undefined } & {all: string | undefined};
3+
>Errors : Errors<T>
4+
>all : string | undefined
5+
6+
function foo<T>() {
7+
>foo : <T>() => void
8+
9+
let obj!: Errors<T>
10+
>obj : Errors<T>
11+
12+
let x!: keyof T;
13+
>x : keyof T
14+
15+
obj[x] = undefined;
16+
>obj[x] = undefined : undefined
17+
>obj[x] : Errors<T>[keyof T]
18+
>obj : Errors<T>
19+
>x : keyof T
20+
>undefined : undefined
21+
}
22+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @strict: true
2+
type Errors<T> = { [P in keyof T]: string | undefined } & {all: string | undefined};
3+
function foo<T>() {
4+
let obj!: Errors<T>
5+
let x!: keyof T;
6+
obj[x] = undefined;
7+
}

0 commit comments

Comments
 (0)