Skip to content

Commit a4705ef

Browse files
committed
add silly test
1 parent 620e38b commit a4705ef

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//// [tests/cases/compiler/reverseMappedFromContravariantPosition1.ts] ////
2+
3+
=== reverseMappedFromContravariantPosition1.ts ===
4+
declare function test1<T>(
5+
>test1 : Symbol(test1, Decl(reverseMappedFromContravariantPosition1.ts, 0, 0))
6+
>T : Symbol(T, Decl(reverseMappedFromContravariantPosition1.ts, 0, 23))
7+
8+
cb: (arg: { [K in keyof T]: { prop: T[K] } }) => void,
9+
>cb : Symbol(cb, Decl(reverseMappedFromContravariantPosition1.ts, 0, 26))
10+
>arg : Symbol(arg, Decl(reverseMappedFromContravariantPosition1.ts, 1, 7))
11+
>K : Symbol(K, Decl(reverseMappedFromContravariantPosition1.ts, 1, 15))
12+
>T : Symbol(T, Decl(reverseMappedFromContravariantPosition1.ts, 0, 23))
13+
>prop : Symbol(prop, Decl(reverseMappedFromContravariantPosition1.ts, 1, 31))
14+
>T : Symbol(T, Decl(reverseMappedFromContravariantPosition1.ts, 0, 23))
15+
>K : Symbol(K, Decl(reverseMappedFromContravariantPosition1.ts, 1, 15))
16+
17+
): T;
18+
>T : Symbol(T, Decl(reverseMappedFromContravariantPosition1.ts, 0, 23))
19+
20+
type Arg = {
21+
>Arg : Symbol(Arg, Decl(reverseMappedFromContravariantPosition1.ts, 2, 5))
22+
23+
a: {
24+
>a : Symbol(a, Decl(reverseMappedFromContravariantPosition1.ts, 4, 12))
25+
26+
prop: number;
27+
>prop : Symbol(prop, Decl(reverseMappedFromContravariantPosition1.ts, 5, 6))
28+
29+
};
30+
b: {
31+
>b : Symbol(b, Decl(reverseMappedFromContravariantPosition1.ts, 7, 4))
32+
33+
prop: boolean;
34+
>prop : Symbol(prop, Decl(reverseMappedFromContravariantPosition1.ts, 8, 6))
35+
36+
};
37+
};
38+
39+
const result1 = test1((arg: Arg) => {});
40+
>result1 : Symbol(result1, Decl(reverseMappedFromContravariantPosition1.ts, 13, 5))
41+
>test1 : Symbol(test1, Decl(reverseMappedFromContravariantPosition1.ts, 0, 0))
42+
>arg : Symbol(arg, Decl(reverseMappedFromContravariantPosition1.ts, 13, 23))
43+
>Arg : Symbol(Arg, Decl(reverseMappedFromContravariantPosition1.ts, 2, 5))
44+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//// [tests/cases/compiler/reverseMappedFromContravariantPosition1.ts] ////
2+
3+
=== reverseMappedFromContravariantPosition1.ts ===
4+
declare function test1<T>(
5+
>test1 : <T>(cb: (arg: { [K in keyof T]: { prop: T[K]; }; }) => void) => T
6+
> : ^ ^^ ^^ ^^^^^
7+
8+
cb: (arg: { [K in keyof T]: { prop: T[K] } }) => void,
9+
>cb : (arg: { [K in keyof T]: { prop: T[K]; }; }) => void
10+
> : ^ ^^ ^^^^^
11+
>arg : { [K in keyof T]: { prop: T[K]; }; }
12+
> : ^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^
13+
>prop : T[K]
14+
> : ^^^^
15+
16+
): T;
17+
18+
type Arg = {
19+
>Arg : Arg
20+
> : ^^^
21+
22+
a: {
23+
>a : { prop: number; }
24+
> : ^^^^^^^^ ^^^
25+
26+
prop: number;
27+
>prop : number
28+
> : ^^^^^^
29+
30+
};
31+
b: {
32+
>b : { prop: boolean; }
33+
> : ^^^^^^^^ ^^^
34+
35+
prop: boolean;
36+
>prop : boolean
37+
> : ^^^^^^^
38+
39+
};
40+
};
41+
42+
const result1 = test1((arg: Arg) => {});
43+
>result1 : { a: number; b: boolean; }
44+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
45+
>test1((arg: Arg) => {}) : { a: number; b: boolean; }
46+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
47+
>test1 : <T>(cb: (arg: { [K in keyof T]: { prop: T[K]; }; }) => void) => T
48+
> : ^ ^^ ^^ ^^^^^
49+
>(arg: Arg) => {} : (arg: Arg) => void
50+
> : ^ ^^ ^^^^^^^^^
51+
>arg : Arg
52+
> : ^^^
53+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @strict: true
2+
// @noEmit: true
3+
4+
declare function test1<T>(
5+
cb: (arg: { [K in keyof T]: { prop: T[K] } }) => void,
6+
): T;
7+
8+
type Arg = {
9+
a: {
10+
prop: number;
11+
};
12+
b: {
13+
prop: boolean;
14+
};
15+
};
16+
17+
const result1 = test1((arg: Arg) => {});

0 commit comments

Comments
 (0)