Adding test
This commit is contained in:
parent
d0e526983a
commit
7efd93a965
3 changed files with 54 additions and 0 deletions
|
@ -0,0 +1,28 @@
|
||||||
|
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(1,6): error TS2456: Type alias 'typeAlias1' circularly references itself.
|
||||||
|
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(2,5): error TS2502: 'varOfAliasedType1' is referenced directly or indirectly in its own type annotation.
|
||||||
|
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(4,5): error TS2502: 'varOfAliasedType2' is referenced directly or indirectly in its own type annotation.
|
||||||
|
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(5,6): error TS2456: Type alias 'typeAlias2' circularly references itself.
|
||||||
|
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(9,6): error TS2456: Type alias 'typeAlias3' circularly references itself.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts (5 errors) ====
|
||||||
|
type typeAlias1 = typeof varOfAliasedType1;
|
||||||
|
~~~~~~~~~~
|
||||||
|
!!! error TS2456: Type alias 'typeAlias1' circularly references itself.
|
||||||
|
var varOfAliasedType1: typeAlias1;
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
|
!!! error TS2502: 'varOfAliasedType1' is referenced directly or indirectly in its own type annotation.
|
||||||
|
|
||||||
|
var varOfAliasedType2: typeAlias2;
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
|
!!! error TS2502: 'varOfAliasedType2' is referenced directly or indirectly in its own type annotation.
|
||||||
|
type typeAlias2 = typeof varOfAliasedType2;
|
||||||
|
~~~~~~~~~~
|
||||||
|
!!! error TS2456: Type alias 'typeAlias2' circularly references itself.
|
||||||
|
|
||||||
|
function func(): typeAlias3 { return null; }
|
||||||
|
var varOfAliasedType3 = func();
|
||||||
|
type typeAlias3 = typeof varOfAliasedType3;
|
||||||
|
~~~~~~~~~~
|
||||||
|
!!! error TS2456: Type alias 'typeAlias3' circularly references itself.
|
||||||
|
|
17
tests/baselines/reference/circularTypeofWithVarOrFunc.js
Normal file
17
tests/baselines/reference/circularTypeofWithVarOrFunc.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
//// [circularTypeofWithVarOrFunc.ts]
|
||||||
|
type typeAlias1 = typeof varOfAliasedType1;
|
||||||
|
var varOfAliasedType1: typeAlias1;
|
||||||
|
|
||||||
|
var varOfAliasedType2: typeAlias2;
|
||||||
|
type typeAlias2 = typeof varOfAliasedType2;
|
||||||
|
|
||||||
|
function func(): typeAlias3 { return null; }
|
||||||
|
var varOfAliasedType3 = func();
|
||||||
|
type typeAlias3 = typeof varOfAliasedType3;
|
||||||
|
|
||||||
|
|
||||||
|
//// [circularTypeofWithVarOrFunc.js]
|
||||||
|
var varOfAliasedType1;
|
||||||
|
var varOfAliasedType2;
|
||||||
|
function func() { return null; }
|
||||||
|
var varOfAliasedType3 = func();
|
|
@ -0,0 +1,9 @@
|
||||||
|
type typeAlias1 = typeof varOfAliasedType1;
|
||||||
|
var varOfAliasedType1: typeAlias1;
|
||||||
|
|
||||||
|
var varOfAliasedType2: typeAlias2;
|
||||||
|
type typeAlias2 = typeof varOfAliasedType2;
|
||||||
|
|
||||||
|
function func(): typeAlias3 { return null; }
|
||||||
|
var varOfAliasedType3 = func();
|
||||||
|
type typeAlias3 = typeof varOfAliasedType3;
|
Loading…
Reference in a new issue