Accepting new baselines

This commit is contained in:
Anders Hejlsberg 2015-05-01 15:05:42 -07:00
parent a133684b36
commit 8600fef2bd
7 changed files with 104 additions and 414 deletions

View file

@ -1,6 +1,6 @@
tests/cases/compiler/implicitAnyFromCircularInference.ts(3,5): error TS7021: 'a' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(7,5): error TS7021: 'c' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(10,5): error TS7021: 'd' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(3,5): error TS2502: 'a' is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(7,5): error TS2502: 'c' is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(10,5): error TS2502: 'd' is referenced directly or indirectly in its own type annotation.
tests/cases/compiler/implicitAnyFromCircularInference.ts(15,10): error TS7023: 'g' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
tests/cases/compiler/implicitAnyFromCircularInference.ts(18,10): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
tests/cases/compiler/implicitAnyFromCircularInference.ts(23,10): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
@ -14,18 +14,18 @@ tests/cases/compiler/implicitAnyFromCircularInference.ts(46,5): error TS7023: 'x
// Error expected
var a: typeof a;
~
!!! error TS7021: 'a' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
!!! error TS2502: 'a' is referenced directly or indirectly in its own type annotation.
// Error expected on b or c
var b: typeof c;
var c: typeof b;
~
!!! error TS7021: 'c' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
!!! error TS2502: 'c' is referenced directly or indirectly in its own type annotation.
// Error expected
var d: Array<typeof d>;
~
!!! error TS7021: 'd' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.
!!! error TS2502: 'd' is referenced directly or indirectly in its own type annotation.
function f() { return f; }

View file

@ -0,0 +1,73 @@
tests/cases/conformance/types/specifyingTypes/typeQueries/recursiveTypesWithTypeof.ts(2,5): error TS2502: 'c' is referenced directly or indirectly in its own type annotation.
tests/cases/conformance/types/specifyingTypes/typeQueries/recursiveTypesWithTypeof.ts(6,5): error TS2502: 'e' is referenced directly or indirectly in its own type annotation.
tests/cases/conformance/types/specifyingTypes/typeQueries/recursiveTypesWithTypeof.ts(10,5): error TS2502: 'f' is referenced directly or indirectly in its own type annotation.
tests/cases/conformance/types/specifyingTypes/typeQueries/recursiveTypesWithTypeof.ts(12,5): error TS2502: 'f2' is referenced directly or indirectly in its own type annotation.
tests/cases/conformance/types/specifyingTypes/typeQueries/recursiveTypesWithTypeof.ts(14,5): error TS2502: 'f3' is referenced directly or indirectly in its own type annotation.
tests/cases/conformance/types/specifyingTypes/typeQueries/recursiveTypesWithTypeof.ts(51,5): error TS2502: 'hy3' is referenced directly or indirectly in its own type annotation.
==== tests/cases/conformance/types/specifyingTypes/typeQueries/recursiveTypesWithTypeof.ts (6 errors) ====
// The following are errors because of circular references
var c: typeof c;
~
!!! error TS2502: 'c' is referenced directly or indirectly in its own type annotation.
var c: any;
var d: typeof e;
var d: any;
var e: typeof d;
~
!!! error TS2502: 'e' is referenced directly or indirectly in its own type annotation.
var e: any;
interface Foo<T> { }
var f: Array<typeof f>;
~
!!! error TS2502: 'f' is referenced directly or indirectly in its own type annotation.
var f: any;
var f2: Foo<typeof f2>;
~~
!!! error TS2502: 'f2' is referenced directly or indirectly in its own type annotation.
var f2: any;
var f3: Foo<typeof f3>[];
~~
!!! error TS2502: 'f3' is referenced directly or indirectly in its own type annotation.
var f3: any;
// None of these declarations should have any errors!
// Truly recursive types
var g: { x: typeof g; };
var g: typeof g.x;
var h: () => typeof h;
var h = h();
var i: (x: typeof i) => typeof x;
var i = i(i);
var j: <T extends typeof j>(x: T) => T;
var j = j(j);
// Same as h, i, j with construct signatures
var h2: new () => typeof h2;
var h2 = new h2();
var i2: new (x: typeof i2) => typeof x;
var i2 = new i2(i2);
var j2: new <T extends typeof j2>(x: T) => T;
var j2 = new j2(j2);
// Indexers
var k: { [n: number]: typeof k;[s: string]: typeof k };
var k = k[0];
var k = k[''];
// Hybrid - contains type literals as well as type arguments
// These two are recursive
var hy1: { x: typeof hy1 }[];
var hy1 = hy1[0].x;
var hy2: { x: Array<typeof hy2> };
var hy2 = hy2.x[0];
interface Foo2<T, U> { }
// This one should be an error because the first type argument is not contained inside a type literal
var hy3: Foo2<typeof hy3, { x: typeof hy3 }>;
~~~
!!! error TS2502: 'hy3' is referenced directly or indirectly in its own type annotation.
var hy3: any;

View file

@ -1,6 +1,5 @@
//// [recursiveTypesWithTypeof.ts]
// None of these declarations should have any errors!
// Using typeof directly, these should be any
// The following are errors because of circular references
var c: typeof c;
var c: any;
var d: typeof e;
@ -8,7 +7,6 @@ var d: any;
var e: typeof d;
var e: any;
// In type arguments, these should be any
interface Foo<T> { }
var f: Array<typeof f>;
var f: any;
@ -17,6 +15,7 @@ var f2: any;
var f3: Foo<typeof f3>[];
var f3: any;
// None of these declarations should have any errors!
// Truly recursive types
var g: { x: typeof g; };
var g: typeof g.x;
@ -49,25 +48,25 @@ var hy2 = hy2.x[0];
interface Foo2<T, U> { }
// This one should be any because the first type argument is not contained inside a type literal
// This one should be an error because the first type argument is not contained inside a type literal
var hy3: Foo2<typeof hy3, { x: typeof hy3 }>;
var hy3: any;
//// [recursiveTypesWithTypeof.js]
// The following are errors because of circular references
var c;
var c;
var d;
var d;
var e;
var e;
var f;
var f;
var f2;
var f2;
var f3;
var f3;
// None of these declarations should have any errors!
// Using typeof directly, these should be any
var c;
var c;
var d;
var d;
var e;
var e;
var f;
var f;
var f2;
var f2;
var f3;
var f3;
// Truly recursive types
var g;
var g;
@ -94,6 +93,6 @@ var hy1;
var hy1 = hy1[0].x;
var hy2;
var hy2 = hy2.x[0];
// This one should be any because the first type argument is not contained inside a type literal
// This one should be an error because the first type argument is not contained inside a type literal
var hy3;
var hy3;

View file

@ -1,187 +0,0 @@
=== tests/cases/conformance/types/specifyingTypes/typeQueries/recursiveTypesWithTypeof.ts ===
// None of these declarations should have any errors!
// Using typeof directly, these should be any
var c: typeof c;
>c : Symbol(c, Decl(recursiveTypesWithTypeof.ts, 2, 3), Decl(recursiveTypesWithTypeof.ts, 3, 3))
>c : Symbol(c, Decl(recursiveTypesWithTypeof.ts, 2, 3), Decl(recursiveTypesWithTypeof.ts, 3, 3))
var c: any;
>c : Symbol(c, Decl(recursiveTypesWithTypeof.ts, 2, 3), Decl(recursiveTypesWithTypeof.ts, 3, 3))
var d: typeof e;
>d : Symbol(d, Decl(recursiveTypesWithTypeof.ts, 4, 3), Decl(recursiveTypesWithTypeof.ts, 5, 3))
>e : Symbol(e, Decl(recursiveTypesWithTypeof.ts, 6, 3), Decl(recursiveTypesWithTypeof.ts, 7, 3))
var d: any;
>d : Symbol(d, Decl(recursiveTypesWithTypeof.ts, 4, 3), Decl(recursiveTypesWithTypeof.ts, 5, 3))
var e: typeof d;
>e : Symbol(e, Decl(recursiveTypesWithTypeof.ts, 6, 3), Decl(recursiveTypesWithTypeof.ts, 7, 3))
>d : Symbol(d, Decl(recursiveTypesWithTypeof.ts, 4, 3), Decl(recursiveTypesWithTypeof.ts, 5, 3))
var e: any;
>e : Symbol(e, Decl(recursiveTypesWithTypeof.ts, 6, 3), Decl(recursiveTypesWithTypeof.ts, 7, 3))
// In type arguments, these should be any
interface Foo<T> { }
>Foo : Symbol(Foo, Decl(recursiveTypesWithTypeof.ts, 7, 11))
>T : Symbol(T, Decl(recursiveTypesWithTypeof.ts, 10, 14))
var f: Array<typeof f>;
>f : Symbol(f, Decl(recursiveTypesWithTypeof.ts, 11, 3), Decl(recursiveTypesWithTypeof.ts, 12, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>f : Symbol(f, Decl(recursiveTypesWithTypeof.ts, 11, 3), Decl(recursiveTypesWithTypeof.ts, 12, 3))
var f: any;
>f : Symbol(f, Decl(recursiveTypesWithTypeof.ts, 11, 3), Decl(recursiveTypesWithTypeof.ts, 12, 3))
var f2: Foo<typeof f2>;
>f2 : Symbol(f2, Decl(recursiveTypesWithTypeof.ts, 13, 3), Decl(recursiveTypesWithTypeof.ts, 14, 3))
>Foo : Symbol(Foo, Decl(recursiveTypesWithTypeof.ts, 7, 11))
>f2 : Symbol(f2, Decl(recursiveTypesWithTypeof.ts, 13, 3), Decl(recursiveTypesWithTypeof.ts, 14, 3))
var f2: any;
>f2 : Symbol(f2, Decl(recursiveTypesWithTypeof.ts, 13, 3), Decl(recursiveTypesWithTypeof.ts, 14, 3))
var f3: Foo<typeof f3>[];
>f3 : Symbol(f3, Decl(recursiveTypesWithTypeof.ts, 15, 3), Decl(recursiveTypesWithTypeof.ts, 16, 3))
>Foo : Symbol(Foo, Decl(recursiveTypesWithTypeof.ts, 7, 11))
>f3 : Symbol(f3, Decl(recursiveTypesWithTypeof.ts, 15, 3), Decl(recursiveTypesWithTypeof.ts, 16, 3))
var f3: any;
>f3 : Symbol(f3, Decl(recursiveTypesWithTypeof.ts, 15, 3), Decl(recursiveTypesWithTypeof.ts, 16, 3))
// Truly recursive types
var g: { x: typeof g; };
>g : Symbol(g, Decl(recursiveTypesWithTypeof.ts, 19, 3), Decl(recursiveTypesWithTypeof.ts, 20, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 19, 8))
>g : Symbol(g, Decl(recursiveTypesWithTypeof.ts, 19, 3), Decl(recursiveTypesWithTypeof.ts, 20, 3))
var g: typeof g.x;
>g : Symbol(g, Decl(recursiveTypesWithTypeof.ts, 19, 3), Decl(recursiveTypesWithTypeof.ts, 20, 3))
>g.x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 19, 8))
>g : Symbol(g, Decl(recursiveTypesWithTypeof.ts, 19, 3), Decl(recursiveTypesWithTypeof.ts, 20, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 19, 8))
var h: () => typeof h;
>h : Symbol(h, Decl(recursiveTypesWithTypeof.ts, 21, 3), Decl(recursiveTypesWithTypeof.ts, 22, 3))
>h : Symbol(h, Decl(recursiveTypesWithTypeof.ts, 21, 3), Decl(recursiveTypesWithTypeof.ts, 22, 3))
var h = h();
>h : Symbol(h, Decl(recursiveTypesWithTypeof.ts, 21, 3), Decl(recursiveTypesWithTypeof.ts, 22, 3))
>h : Symbol(h, Decl(recursiveTypesWithTypeof.ts, 21, 3), Decl(recursiveTypesWithTypeof.ts, 22, 3))
var i: (x: typeof i) => typeof x;
>i : Symbol(i, Decl(recursiveTypesWithTypeof.ts, 23, 3), Decl(recursiveTypesWithTypeof.ts, 24, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 23, 8))
>i : Symbol(i, Decl(recursiveTypesWithTypeof.ts, 23, 3), Decl(recursiveTypesWithTypeof.ts, 24, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 23, 8))
var i = i(i);
>i : Symbol(i, Decl(recursiveTypesWithTypeof.ts, 23, 3), Decl(recursiveTypesWithTypeof.ts, 24, 3))
>i : Symbol(i, Decl(recursiveTypesWithTypeof.ts, 23, 3), Decl(recursiveTypesWithTypeof.ts, 24, 3))
>i : Symbol(i, Decl(recursiveTypesWithTypeof.ts, 23, 3), Decl(recursiveTypesWithTypeof.ts, 24, 3))
var j: <T extends typeof j>(x: T) => T;
>j : Symbol(j, Decl(recursiveTypesWithTypeof.ts, 25, 3), Decl(recursiveTypesWithTypeof.ts, 26, 3))
>T : Symbol(T, Decl(recursiveTypesWithTypeof.ts, 25, 8))
>j : Symbol(j, Decl(recursiveTypesWithTypeof.ts, 25, 3), Decl(recursiveTypesWithTypeof.ts, 26, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 25, 28))
>T : Symbol(T, Decl(recursiveTypesWithTypeof.ts, 25, 8))
>T : Symbol(T, Decl(recursiveTypesWithTypeof.ts, 25, 8))
var j = j(j);
>j : Symbol(j, Decl(recursiveTypesWithTypeof.ts, 25, 3), Decl(recursiveTypesWithTypeof.ts, 26, 3))
>j : Symbol(j, Decl(recursiveTypesWithTypeof.ts, 25, 3), Decl(recursiveTypesWithTypeof.ts, 26, 3))
>j : Symbol(j, Decl(recursiveTypesWithTypeof.ts, 25, 3), Decl(recursiveTypesWithTypeof.ts, 26, 3))
// Same as h, i, j with construct signatures
var h2: new () => typeof h2;
>h2 : Symbol(h2, Decl(recursiveTypesWithTypeof.ts, 29, 3), Decl(recursiveTypesWithTypeof.ts, 30, 3))
>h2 : Symbol(h2, Decl(recursiveTypesWithTypeof.ts, 29, 3), Decl(recursiveTypesWithTypeof.ts, 30, 3))
var h2 = new h2();
>h2 : Symbol(h2, Decl(recursiveTypesWithTypeof.ts, 29, 3), Decl(recursiveTypesWithTypeof.ts, 30, 3))
>h2 : Symbol(h2, Decl(recursiveTypesWithTypeof.ts, 29, 3), Decl(recursiveTypesWithTypeof.ts, 30, 3))
var i2: new (x: typeof i2) => typeof x;
>i2 : Symbol(i2, Decl(recursiveTypesWithTypeof.ts, 31, 3), Decl(recursiveTypesWithTypeof.ts, 32, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 31, 13))
>i2 : Symbol(i2, Decl(recursiveTypesWithTypeof.ts, 31, 3), Decl(recursiveTypesWithTypeof.ts, 32, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 31, 13))
var i2 = new i2(i2);
>i2 : Symbol(i2, Decl(recursiveTypesWithTypeof.ts, 31, 3), Decl(recursiveTypesWithTypeof.ts, 32, 3))
>i2 : Symbol(i2, Decl(recursiveTypesWithTypeof.ts, 31, 3), Decl(recursiveTypesWithTypeof.ts, 32, 3))
>i2 : Symbol(i2, Decl(recursiveTypesWithTypeof.ts, 31, 3), Decl(recursiveTypesWithTypeof.ts, 32, 3))
var j2: new <T extends typeof j2>(x: T) => T;
>j2 : Symbol(j2, Decl(recursiveTypesWithTypeof.ts, 33, 3), Decl(recursiveTypesWithTypeof.ts, 34, 3))
>T : Symbol(T, Decl(recursiveTypesWithTypeof.ts, 33, 13))
>j2 : Symbol(j2, Decl(recursiveTypesWithTypeof.ts, 33, 3), Decl(recursiveTypesWithTypeof.ts, 34, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 33, 34))
>T : Symbol(T, Decl(recursiveTypesWithTypeof.ts, 33, 13))
>T : Symbol(T, Decl(recursiveTypesWithTypeof.ts, 33, 13))
var j2 = new j2(j2);
>j2 : Symbol(j2, Decl(recursiveTypesWithTypeof.ts, 33, 3), Decl(recursiveTypesWithTypeof.ts, 34, 3))
>j2 : Symbol(j2, Decl(recursiveTypesWithTypeof.ts, 33, 3), Decl(recursiveTypesWithTypeof.ts, 34, 3))
>j2 : Symbol(j2, Decl(recursiveTypesWithTypeof.ts, 33, 3), Decl(recursiveTypesWithTypeof.ts, 34, 3))
// Indexers
var k: { [n: number]: typeof k;[s: string]: typeof k };
>k : Symbol(k, Decl(recursiveTypesWithTypeof.ts, 37, 3), Decl(recursiveTypesWithTypeof.ts, 38, 3), Decl(recursiveTypesWithTypeof.ts, 39, 3))
>n : Symbol(n, Decl(recursiveTypesWithTypeof.ts, 37, 10))
>k : Symbol(k, Decl(recursiveTypesWithTypeof.ts, 37, 3), Decl(recursiveTypesWithTypeof.ts, 38, 3), Decl(recursiveTypesWithTypeof.ts, 39, 3))
>s : Symbol(s, Decl(recursiveTypesWithTypeof.ts, 37, 32))
>k : Symbol(k, Decl(recursiveTypesWithTypeof.ts, 37, 3), Decl(recursiveTypesWithTypeof.ts, 38, 3), Decl(recursiveTypesWithTypeof.ts, 39, 3))
var k = k[0];
>k : Symbol(k, Decl(recursiveTypesWithTypeof.ts, 37, 3), Decl(recursiveTypesWithTypeof.ts, 38, 3), Decl(recursiveTypesWithTypeof.ts, 39, 3))
>k : Symbol(k, Decl(recursiveTypesWithTypeof.ts, 37, 3), Decl(recursiveTypesWithTypeof.ts, 38, 3), Decl(recursiveTypesWithTypeof.ts, 39, 3))
var k = k[''];
>k : Symbol(k, Decl(recursiveTypesWithTypeof.ts, 37, 3), Decl(recursiveTypesWithTypeof.ts, 38, 3), Decl(recursiveTypesWithTypeof.ts, 39, 3))
>k : Symbol(k, Decl(recursiveTypesWithTypeof.ts, 37, 3), Decl(recursiveTypesWithTypeof.ts, 38, 3), Decl(recursiveTypesWithTypeof.ts, 39, 3))
// Hybrid - contains type literals as well as type arguments
// These two are recursive
var hy1: { x: typeof hy1 }[];
>hy1 : Symbol(hy1, Decl(recursiveTypesWithTypeof.ts, 43, 3), Decl(recursiveTypesWithTypeof.ts, 44, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 43, 10))
>hy1 : Symbol(hy1, Decl(recursiveTypesWithTypeof.ts, 43, 3), Decl(recursiveTypesWithTypeof.ts, 44, 3))
var hy1 = hy1[0].x;
>hy1 : Symbol(hy1, Decl(recursiveTypesWithTypeof.ts, 43, 3), Decl(recursiveTypesWithTypeof.ts, 44, 3))
>hy1[0].x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 43, 10))
>hy1 : Symbol(hy1, Decl(recursiveTypesWithTypeof.ts, 43, 3), Decl(recursiveTypesWithTypeof.ts, 44, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 43, 10))
var hy2: { x: Array<typeof hy2> };
>hy2 : Symbol(hy2, Decl(recursiveTypesWithTypeof.ts, 45, 3), Decl(recursiveTypesWithTypeof.ts, 46, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 45, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>hy2 : Symbol(hy2, Decl(recursiveTypesWithTypeof.ts, 45, 3), Decl(recursiveTypesWithTypeof.ts, 46, 3))
var hy2 = hy2.x[0];
>hy2 : Symbol(hy2, Decl(recursiveTypesWithTypeof.ts, 45, 3), Decl(recursiveTypesWithTypeof.ts, 46, 3))
>hy2.x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 45, 10))
>hy2 : Symbol(hy2, Decl(recursiveTypesWithTypeof.ts, 45, 3), Decl(recursiveTypesWithTypeof.ts, 46, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 45, 10))
interface Foo2<T, U> { }
>Foo2 : Symbol(Foo2, Decl(recursiveTypesWithTypeof.ts, 46, 19))
>T : Symbol(T, Decl(recursiveTypesWithTypeof.ts, 48, 15))
>U : Symbol(U, Decl(recursiveTypesWithTypeof.ts, 48, 17))
// This one should be any because the first type argument is not contained inside a type literal
var hy3: Foo2<typeof hy3, { x: typeof hy3 }>;
>hy3 : Symbol(hy3, Decl(recursiveTypesWithTypeof.ts, 51, 3), Decl(recursiveTypesWithTypeof.ts, 52, 3))
>Foo2 : Symbol(Foo2, Decl(recursiveTypesWithTypeof.ts, 46, 19))
>hy3 : Symbol(hy3, Decl(recursiveTypesWithTypeof.ts, 51, 3), Decl(recursiveTypesWithTypeof.ts, 52, 3))
>x : Symbol(x, Decl(recursiveTypesWithTypeof.ts, 51, 27))
>hy3 : Symbol(hy3, Decl(recursiveTypesWithTypeof.ts, 51, 3), Decl(recursiveTypesWithTypeof.ts, 52, 3))
var hy3: any;
>hy3 : Symbol(hy3, Decl(recursiveTypesWithTypeof.ts, 51, 3), Decl(recursiveTypesWithTypeof.ts, 52, 3))

View file

@ -1,201 +0,0 @@
=== tests/cases/conformance/types/specifyingTypes/typeQueries/recursiveTypesWithTypeof.ts ===
// None of these declarations should have any errors!
// Using typeof directly, these should be any
var c: typeof c;
>c : any
>c : any
var c: any;
>c : any
var d: typeof e;
>d : any
>e : any
var d: any;
>d : any
var e: typeof d;
>e : any
>d : any
var e: any;
>e : any
// In type arguments, these should be any
interface Foo<T> { }
>Foo : Foo<T>
>T : T
var f: Array<typeof f>;
>f : any
>Array : T[]
>f : any
var f: any;
>f : any
var f2: Foo<typeof f2>;
>f2 : any
>Foo : Foo<T>
>f2 : any
var f2: any;
>f2 : any
var f3: Foo<typeof f3>[];
>f3 : any
>Foo : Foo<T>
>f3 : any
var f3: any;
>f3 : any
// Truly recursive types
var g: { x: typeof g; };
>g : { x: any; }
>x : { x: any; }
>g : { x: any; }
var g: typeof g.x;
>g : { x: any; }
>g.x : { x: any; }
>g : { x: any; }
>x : { x: any; }
var h: () => typeof h;
>h : () => any
>h : () => any
var h = h();
>h : () => any
>h() : () => any
>h : () => any
var i: (x: typeof i) => typeof x;
>i : (x: any) => any
>x : (x: any) => any
>i : (x: any) => any
>x : (x: any) => any
var i = i(i);
>i : (x: any) => any
>i(i) : (x: any) => any
>i : (x: any) => any
>i : (x: any) => any
var j: <T extends typeof j>(x: T) => T;
>j : <T extends any>(x: T) => T
>T : T
>j : <T extends any>(x: T) => T
>x : T
>T : T
>T : T
var j = j(j);
>j : <T extends any>(x: T) => T
>j(j) : <T extends any>(x: T) => T
>j : <T extends any>(x: T) => T
>j : <T extends any>(x: T) => T
// Same as h, i, j with construct signatures
var h2: new () => typeof h2;
>h2 : new () => any
>h2 : new () => any
var h2 = new h2();
>h2 : new () => any
>new h2() : new () => any
>h2 : new () => any
var i2: new (x: typeof i2) => typeof x;
>i2 : new (x: any) => any
>x : new (x: any) => any
>i2 : new (x: any) => any
>x : new (x: any) => any
var i2 = new i2(i2);
>i2 : new (x: any) => any
>new i2(i2) : new (x: any) => any
>i2 : new (x: any) => any
>i2 : new (x: any) => any
var j2: new <T extends typeof j2>(x: T) => T;
>j2 : new <T extends any>(x: T) => T
>T : T
>j2 : new <T extends any>(x: T) => T
>x : T
>T : T
>T : T
var j2 = new j2(j2);
>j2 : new <T extends any>(x: T) => T
>new j2(j2) : new <T extends any>(x: T) => T
>j2 : new <T extends any>(x: T) => T
>j2 : new <T extends any>(x: T) => T
// Indexers
var k: { [n: number]: typeof k;[s: string]: typeof k };
>k : { [s: string]: any; [n: number]: any; }
>n : number
>k : { [s: string]: any; [n: number]: any; }
>s : string
>k : { [s: string]: any; [n: number]: any; }
var k = k[0];
>k : { [s: string]: any; [n: number]: any; }
>k[0] : { [s: string]: any; [n: number]: any; }
>k : { [s: string]: any; [n: number]: any; }
>0 : number
var k = k[''];
>k : { [s: string]: any; [n: number]: any; }
>k[''] : { [s: string]: any; [n: number]: any; }
>k : { [s: string]: any; [n: number]: any; }
>'' : string
// Hybrid - contains type literals as well as type arguments
// These two are recursive
var hy1: { x: typeof hy1 }[];
>hy1 : { x: any[]; }[]
>x : { x: any[]; }[]
>hy1 : { x: any[]; }[]
var hy1 = hy1[0].x;
>hy1 : { x: any[]; }[]
>hy1[0].x : { x: any[]; }[]
>hy1[0] : { x: any[]; }
>hy1 : { x: any[]; }[]
>0 : number
>x : { x: any[]; }[]
var hy2: { x: Array<typeof hy2> };
>hy2 : { x: any[]; }
>x : { x: any[]; }[]
>Array : T[]
>hy2 : { x: any[]; }
var hy2 = hy2.x[0];
>hy2 : { x: any[]; }
>hy2.x[0] : { x: any[]; }
>hy2.x : { x: any[]; }[]
>hy2 : { x: any[]; }
>x : { x: any[]; }[]
>0 : number
interface Foo2<T, U> { }
>Foo2 : Foo2<T, U>
>T : T
>U : U
// This one should be any because the first type argument is not contained inside a type literal
var hy3: Foo2<typeof hy3, { x: typeof hy3 }>;
>hy3 : any
>Foo2 : Foo2<T, U>
>hy3 : any
>x : any
>hy3 : any
var hy3: any;
>hy3 : any

View file

@ -1,7 +1,8 @@
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation.
==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts (1 errors) ====
==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts (2 errors) ====
var x = 1;
export var r1: typeof x;
~~~~~~~~~~~~~~~~~~~~~~~~
@ -46,6 +47,8 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType
export var r11: typeof E.A;
export var r12: typeof r12;
~~~
!!! error TS2502: 'r12' is referenced directly or indirectly in its own type annotation.
function foo() { }
module foo {

View file

@ -1,7 +1,8 @@
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation.
==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts (1 errors) ====
==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts (2 errors) ====
export var x = 1;
~~~~~~~~~~~~~~~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
@ -46,6 +47,8 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.t
export var r11: typeof E.A;
export var r12: typeof r12;
~~~
!!! error TS2502: 'r12' is referenced directly or indirectly in its own type annotation.
export function foo() { }
export module foo {