Skip to content

Commit 9c3dc96

Browse files
committed
Accept new baselines
1 parent efdbbd1 commit 9c3dc96

4 files changed

+139
-1
lines changed

tests/baselines/reference/circularTypeofWithVarOrFunc.errors.txt

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarO
44
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(5,6): error TS2456: Type alias 'typeAlias2' circularly references itself.
55
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(7,18): error TS2576: Return type annotation circularly references itself.
66
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(9,6): error TS2456: Type alias 'typeAlias3' circularly references itself.
7+
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(18,6): error TS2456: Type alias 'R' circularly references itself.
8+
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(19,29): error TS2576: Return type annotation circularly references itself.
9+
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(25,6): error TS2456: Type alias 'R2' circularly references itself.
10+
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(26,15): error TS2576: Return type annotation circularly references itself.
711

812

9-
==== tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts (6 errors) ====
13+
==== tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts (10 errors) ====
1014
type typeAlias1 = typeof varOfAliasedType1;
1115
~~~~~~~~~~
1216
!!! error TS2456: Type alias 'typeAlias1' circularly references itself.
@@ -28,4 +32,29 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarO
2832
type typeAlias3 = typeof varOfAliasedType3;
2933
~~~~~~~~~~
3034
!!! error TS2456: Type alias 'typeAlias3' circularly references itself.
35+
36+
// Repro from #26104
37+
38+
interface Input {
39+
a: number;
40+
b: number;
41+
}
42+
43+
type R = ReturnType<typeof mul>;
44+
~
45+
!!! error TS2456: Type alias 'R' circularly references itself.
46+
function mul(input: Input): R {
47+
~
48+
!!! error TS2576: Return type annotation circularly references itself.
49+
return input.a * input.b;
50+
}
51+
52+
// Repro from #26104
53+
54+
type R2 = ReturnType<typeof f>;
55+
~~
56+
!!! error TS2456: Type alias 'R2' circularly references itself.
57+
function f(): R2 { return 0; }
58+
~~
59+
!!! error TS2576: Return type annotation circularly references itself.
3160

tests/baselines/reference/circularTypeofWithVarOrFunc.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,31 @@ type typeAlias2 = typeof varOfAliasedType2;
88
function func(): typeAlias3 { return null; }
99
var varOfAliasedType3 = func();
1010
type typeAlias3 = typeof varOfAliasedType3;
11+
12+
// Repro from #26104
13+
14+
interface Input {
15+
a: number;
16+
b: number;
17+
}
18+
19+
type R = ReturnType<typeof mul>;
20+
function mul(input: Input): R {
21+
return input.a * input.b;
22+
}
23+
24+
// Repro from #26104
25+
26+
type R2 = ReturnType<typeof f>;
27+
function f(): R2 { return 0; }
1128

1229

1330
//// [circularTypeofWithVarOrFunc.js]
1431
var varOfAliasedType1;
1532
var varOfAliasedType2;
1633
function func() { return null; }
1734
var varOfAliasedType3 = func();
35+
function mul(input) {
36+
return input.a * input.b;
37+
}
38+
function f() { return 0; }

tests/baselines/reference/circularTypeofWithVarOrFunc.symbols

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,46 @@ type typeAlias3 = typeof varOfAliasedType3;
2727
>typeAlias3 : Symbol(typeAlias3, Decl(circularTypeofWithVarOrFunc.ts, 7, 31))
2828
>varOfAliasedType3 : Symbol(varOfAliasedType3, Decl(circularTypeofWithVarOrFunc.ts, 7, 3))
2929

30+
// Repro from #26104
31+
32+
interface Input {
33+
>Input : Symbol(Input, Decl(circularTypeofWithVarOrFunc.ts, 8, 43))
34+
35+
a: number;
36+
>a : Symbol(Input.a, Decl(circularTypeofWithVarOrFunc.ts, 12, 17))
37+
38+
b: number;
39+
>b : Symbol(Input.b, Decl(circularTypeofWithVarOrFunc.ts, 13, 12))
40+
}
41+
42+
type R = ReturnType<typeof mul>;
43+
>R : Symbol(R, Decl(circularTypeofWithVarOrFunc.ts, 15, 1))
44+
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
45+
>mul : Symbol(mul, Decl(circularTypeofWithVarOrFunc.ts, 17, 32))
46+
47+
function mul(input: Input): R {
48+
>mul : Symbol(mul, Decl(circularTypeofWithVarOrFunc.ts, 17, 32))
49+
>input : Symbol(input, Decl(circularTypeofWithVarOrFunc.ts, 18, 13))
50+
>Input : Symbol(Input, Decl(circularTypeofWithVarOrFunc.ts, 8, 43))
51+
>R : Symbol(R, Decl(circularTypeofWithVarOrFunc.ts, 15, 1))
52+
53+
return input.a * input.b;
54+
>input.a : Symbol(Input.a, Decl(circularTypeofWithVarOrFunc.ts, 12, 17))
55+
>input : Symbol(input, Decl(circularTypeofWithVarOrFunc.ts, 18, 13))
56+
>a : Symbol(Input.a, Decl(circularTypeofWithVarOrFunc.ts, 12, 17))
57+
>input.b : Symbol(Input.b, Decl(circularTypeofWithVarOrFunc.ts, 13, 12))
58+
>input : Symbol(input, Decl(circularTypeofWithVarOrFunc.ts, 18, 13))
59+
>b : Symbol(Input.b, Decl(circularTypeofWithVarOrFunc.ts, 13, 12))
60+
}
61+
62+
// Repro from #26104
63+
64+
type R2 = ReturnType<typeof f>;
65+
>R2 : Symbol(R2, Decl(circularTypeofWithVarOrFunc.ts, 20, 1))
66+
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
67+
>f : Symbol(f, Decl(circularTypeofWithVarOrFunc.ts, 24, 31))
68+
69+
function f(): R2 { return 0; }
70+
>f : Symbol(f, Decl(circularTypeofWithVarOrFunc.ts, 24, 31))
71+
>R2 : Symbol(R2, Decl(circularTypeofWithVarOrFunc.ts, 20, 1))
72+

tests/baselines/reference/circularTypeofWithVarOrFunc.types

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,48 @@ type typeAlias3 = typeof varOfAliasedType3;
2929
>typeAlias3 : any
3030
>varOfAliasedType3 : any
3131

32+
// Repro from #26104
33+
34+
interface Input {
35+
>Input : Input
36+
37+
a: number;
38+
>a : number
39+
40+
b: number;
41+
>b : number
42+
}
43+
44+
type R = ReturnType<typeof mul>;
45+
>R : any
46+
>ReturnType : ReturnType<T>
47+
>mul : (input: Input) => any
48+
49+
function mul(input: Input): R {
50+
>mul : (input: Input) => any
51+
>input : Input
52+
>Input : Input
53+
>R : any
54+
55+
return input.a * input.b;
56+
>input.a * input.b : number
57+
>input.a : number
58+
>input : Input
59+
>a : number
60+
>input.b : number
61+
>input : Input
62+
>b : number
63+
}
64+
65+
// Repro from #26104
66+
67+
type R2 = ReturnType<typeof f>;
68+
>R2 : any
69+
>ReturnType : ReturnType<T>
70+
>f : () => any
71+
72+
function f(): R2 { return 0; }
73+
>f : () => any
74+
>R2 : any
75+
>0 : 0
76+

0 commit comments

Comments
 (0)