72 lines
No EOL
3.3 KiB
Text
72 lines
No EOL
3.3 KiB
Text
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(4,6): error TS2456: Type alias 'T0' circularly references itself.
|
|
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(6,6): error TS2456: Type alias 'T0_2' circularly references itself.
|
|
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(11,6): error TS2456: Type alias 'T1' circularly references itself.
|
|
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(14,6): error TS2456: Type alias 'T2' circularly references itself.
|
|
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(16,6): error TS2456: Type alias 'T2_1' circularly references itself.
|
|
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(19,6): error TS2456: Type alias 'T3' circularly references itself.
|
|
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(22,6): error TS2456: Type alias 'T4' circularly references itself.
|
|
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(26,6): error TS2456: Type alias 'T5' circularly references itself.
|
|
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(30,6): error TS2456: Type alias 'T7' circularly references itself.
|
|
|
|
|
|
==== tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts (9 errors) ====
|
|
// It is an error for the type specified in a type alias to depend on that type alias
|
|
|
|
// A type alias directly depends on the type it aliases.
|
|
type T0 = T0
|
|
~~
|
|
!!! error TS2456: Type alias 'T0' circularly references itself.
|
|
type T0_1 = T0_2
|
|
type T0_2 = T0_3
|
|
~~~~
|
|
!!! error TS2456: Type alias 'T0_2' circularly references itself.
|
|
type T0_3 = T0_1
|
|
|
|
// A type reference directly depends on the referenced type and each of the type arguments, if any.
|
|
interface I<T> {}
|
|
type T1 = I<T1>
|
|
~~
|
|
!!! error TS2456: Type alias 'T1' circularly references itself.
|
|
|
|
// A union type directly depends on each of the constituent types.
|
|
type T2 = T2 | string
|
|
~~
|
|
!!! error TS2456: Type alias 'T2' circularly references itself.
|
|
class C<T> {}
|
|
type T2_1 = T2_1[] | number
|
|
~~~~
|
|
!!! error TS2456: Type alias 'T2_1' circularly references itself.
|
|
|
|
// An array type directly depends on its element type.
|
|
type T3 = T3[]
|
|
~~
|
|
!!! error TS2456: Type alias 'T3' circularly references itself.
|
|
|
|
// A tuple type directly depends on each of its element types.
|
|
type T4 = [number, T4]
|
|
~~
|
|
!!! error TS2456: Type alias 'T4' circularly references itself.
|
|
|
|
// A type query directly depends on the type of the referenced entity.
|
|
var x: T5[] = []
|
|
type T5 = typeof x
|
|
~~
|
|
!!! error TS2456: Type alias 'T5' circularly references itself.
|
|
|
|
class C1<T> {}
|
|
type T6 = T7 | number
|
|
type T7 = typeof yy
|
|
~~
|
|
!!! error TS2456: Type alias 'T7' circularly references itself.
|
|
var yy: [string, T8[]];
|
|
type T8 = C<T6>
|
|
|
|
// legal cases
|
|
type T9 = () => T9
|
|
type T10 = { x: T10 } | { new(v: T10): string }
|
|
type T11 = T12[]
|
|
type T12 = [T13, string]
|
|
type T13 = typeof zz
|
|
var zz: { x: T11 }
|
|
|
|
|