Skip to content

Commit 7efd93a

Browse files
committed
Adding test
1 parent d0e5269 commit 7efd93a

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(1,6): error TS2456: Type alias 'typeAlias1' circularly references itself.
2+
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(2,5): error TS2502: 'varOfAliasedType1' is referenced directly or indirectly in its own type annotation.
3+
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(4,5): error TS2502: 'varOfAliasedType2' is referenced directly or indirectly in its own type annotation.
4+
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(5,6): error TS2456: Type alias 'typeAlias2' circularly references itself.
5+
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(9,6): error TS2456: Type alias 'typeAlias3' circularly references itself.
6+
7+
8+
==== tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts (5 errors) ====
9+
type typeAlias1 = typeof varOfAliasedType1;
10+
~~~~~~~~~~
11+
!!! error TS2456: Type alias 'typeAlias1' circularly references itself.
12+
var varOfAliasedType1: typeAlias1;
13+
~~~~~~~~~~~~~~~~~
14+
!!! error TS2502: 'varOfAliasedType1' is referenced directly or indirectly in its own type annotation.
15+
16+
var varOfAliasedType2: typeAlias2;
17+
~~~~~~~~~~~~~~~~~
18+
!!! error TS2502: 'varOfAliasedType2' is referenced directly or indirectly in its own type annotation.
19+
type typeAlias2 = typeof varOfAliasedType2;
20+
~~~~~~~~~~
21+
!!! error TS2456: Type alias 'typeAlias2' circularly references itself.
22+
23+
function func(): typeAlias3 { return null; }
24+
var varOfAliasedType3 = func();
25+
type typeAlias3 = typeof varOfAliasedType3;
26+
~~~~~~~~~~
27+
!!! error TS2456: Type alias 'typeAlias3' circularly references itself.
28+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//// [circularTypeofWithVarOrFunc.ts]
2+
type typeAlias1 = typeof varOfAliasedType1;
3+
var varOfAliasedType1: typeAlias1;
4+
5+
var varOfAliasedType2: typeAlias2;
6+
type typeAlias2 = typeof varOfAliasedType2;
7+
8+
function func(): typeAlias3 { return null; }
9+
var varOfAliasedType3 = func();
10+
type typeAlias3 = typeof varOfAliasedType3;
11+
12+
13+
//// [circularTypeofWithVarOrFunc.js]
14+
var varOfAliasedType1;
15+
var varOfAliasedType2;
16+
function func() { return null; }
17+
var varOfAliasedType3 = func();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
type typeAlias1 = typeof varOfAliasedType1;
2+
var varOfAliasedType1: typeAlias1;
3+
4+
var varOfAliasedType2: typeAlias2;
5+
type typeAlias2 = typeof varOfAliasedType2;
6+
7+
function func(): typeAlias3 { return null; }
8+
var varOfAliasedType3 = func();
9+
type typeAlias3 = typeof varOfAliasedType3;

0 commit comments

Comments
 (0)