mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Merge branch 'master' of https://github.com/Microsoft/TypeScript into generators
Conflicts: src/compiler/diagnosticInformationMap.generated.ts src/compiler/diagnosticMessages.json
This commit is contained in:
@@ -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();
|
||||
@@ -1,15 +1,21 @@
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(4,6): error TS2456: Type alias 'T0' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(5,6): error TS2456: Type alias 'T0_1' 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(7,6): error TS2456: Type alias 'T0_3' 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(25,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(26,6): error TS2456: Type alias 'T5' circularly references itself.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(29,6): error TS2456: Type alias 'T6' 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(31,5): error TS2502: 'yy' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(32,6): error TS2456: Type alias 'T8' circularly references itself.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts (9 errors) ====
|
||||
==== tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts (15 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.
|
||||
@@ -17,10 +23,14 @@ tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(
|
||||
~~
|
||||
!!! error TS2456: Type alias 'T0' circularly references itself.
|
||||
type T0_1 = T0_2
|
||||
~~~~
|
||||
!!! error TS2456: Type alias 'T0_1' circularly references itself.
|
||||
type T0_2 = T0_3
|
||||
~~~~
|
||||
!!! error TS2456: Type alias 'T0_2' circularly references itself.
|
||||
type T0_3 = T0_1
|
||||
~~~~
|
||||
!!! error TS2456: Type alias 'T0_3' circularly references itself.
|
||||
|
||||
// A type reference directly depends on the referenced type and each of the type arguments, if any.
|
||||
interface I<T> {}
|
||||
@@ -49,17 +59,25 @@ tests/cases/conformance/types/typeAliases/directDependenceBetweenTypeAliases.ts(
|
||||
|
||||
// A type query directly depends on the type of the referenced entity.
|
||||
var x: T5[] = []
|
||||
~
|
||||
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
type T5 = typeof x
|
||||
~~
|
||||
!!! error TS2456: Type alias 'T5' circularly references itself.
|
||||
|
||||
class C1<T> {}
|
||||
type T6 = T7 | number
|
||||
~~
|
||||
!!! error TS2456: Type alias 'T6' circularly references itself.
|
||||
type T7 = typeof yy
|
||||
~~
|
||||
!!! error TS2456: Type alias 'T7' circularly references itself.
|
||||
var yy: [string, T8[]];
|
||||
~~
|
||||
!!! error TS2502: 'yy' is referenced directly or indirectly in its own type annotation.
|
||||
type T8 = C<T6>
|
||||
~~
|
||||
!!! error TS2456: Type alias 'T8' circularly references itself.
|
||||
|
||||
// legal cases
|
||||
type T9 = () => T9
|
||||
|
||||
12
tests/baselines/reference/exportDefaultVariable.js
Normal file
12
tests/baselines/reference/exportDefaultVariable.js
Normal file
@@ -0,0 +1,12 @@
|
||||
//// [exportDefaultVariable.ts]
|
||||
// Regression test for #3018
|
||||
|
||||
declare var io: any;
|
||||
|
||||
declare module 'module' {
|
||||
export default io;
|
||||
}
|
||||
|
||||
|
||||
//// [exportDefaultVariable.js]
|
||||
// Regression test for #3018
|
||||
11
tests/baselines/reference/exportDefaultVariable.symbols
Normal file
11
tests/baselines/reference/exportDefaultVariable.symbols
Normal file
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/exportDefaultVariable.ts ===
|
||||
// Regression test for #3018
|
||||
|
||||
declare var io: any;
|
||||
>io : Symbol(io, Decl(exportDefaultVariable.ts, 2, 11))
|
||||
|
||||
declare module 'module' {
|
||||
export default io;
|
||||
>io : Symbol(default, Decl(exportDefaultVariable.ts, 2, 11))
|
||||
}
|
||||
|
||||
11
tests/baselines/reference/exportDefaultVariable.types
Normal file
11
tests/baselines/reference/exportDefaultVariable.types
Normal file
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/exportDefaultVariable.ts ===
|
||||
// Regression test for #3018
|
||||
|
||||
declare var io: any;
|
||||
>io : any
|
||||
|
||||
declare module 'module' {
|
||||
export default io;
|
||||
>io : any
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of33.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of33.ts(4,5): error TS7023: '[Symbol.iterator]' 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/conformance/es6/for-ofStatements/for-of33.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/for-ofStatements/for-of33.ts (2 errors) ====
|
||||
for (var v of new StringIterator) { }
|
||||
~
|
||||
!!! error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
||||
|
||||
class StringIterator {
|
||||
[Symbol.iterator]() {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS7023: '[Symbol.iterator]' 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.
|
||||
return v;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of34.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of34.ts(4,5): error TS7023: 'next' 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/conformance/es6/for-ofStatements/for-of34.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/for-ofStatements/for-of34.ts (2 errors) ====
|
||||
for (var v of new StringIterator) { }
|
||||
~
|
||||
!!! error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
||||
|
||||
class StringIterator {
|
||||
next() {
|
||||
~~~~
|
||||
!!! error TS7023: 'next' 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.
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of35.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of35.ts(4,5): error TS7023: 'next' 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/conformance/es6/for-ofStatements/for-of35.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/for-ofStatements/for-of35.ts (2 errors) ====
|
||||
for (var v of new StringIterator) { }
|
||||
~
|
||||
!!! error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
||||
|
||||
class StringIterator {
|
||||
next() {
|
||||
~~~~
|
||||
!!! error TS7023: 'next' 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.
|
||||
return {
|
||||
done: true,
|
||||
value: v
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck9.ts(1,17): error TS2503: A generator cannot have a 'void' type annotation.
|
||||
tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck9.ts(1,17): error TS2504: A generator cannot have a 'void' type annotation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck9.ts (1 errors) ====
|
||||
function* g3(): void { }
|
||||
~~~~
|
||||
!!! error TS2503: A generator cannot have a 'void' type annotation.
|
||||
!!! error TS2504: A generator cannot have a 'void' type annotation.
|
||||
@@ -1,31 +1,35 @@
|
||||
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(6,5): error TS2502: 'b' 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.
|
||||
tests/cases/compiler/implicitAnyFromCircularInference.ts(26,10): error TS7023: 'h' 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(28,14): error TS7023: 'foo' 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(41,5): error TS7022: 's' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
||||
tests/cases/compiler/implicitAnyFromCircularInference.ts(46,5): error TS7023: 'x' 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 (9 errors) ====
|
||||
==== tests/cases/compiler/implicitAnyFromCircularInference.ts (11 errors) ====
|
||||
|
||||
// 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;
|
||||
~
|
||||
!!! error TS2502: 'b' is referenced directly or indirectly in its own type annotation.
|
||||
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; }
|
||||
|
||||
@@ -52,6 +56,8 @@ tests/cases/compiler/implicitAnyFromCircularInference.ts(46,5): error TS7023: 'x
|
||||
!!! error TS7023: 'h' 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.
|
||||
return foo();
|
||||
function foo() {
|
||||
~~~
|
||||
!!! error TS7023: 'foo' 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.
|
||||
return h() || "hello";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//// [newLineFlagWithCRLF.ts]
|
||||
//// [newLineFlagWithCRLF.ts]
|
||||
var x=1;
|
||||
x=2;
|
||||
|
||||
|
||||
|
||||
//// [newLineFlagWithCRLF.js]
|
||||
var x = 1;
|
||||
x = 2;
|
||||
|
||||
|
||||
//// [newLineFlagWithCRLF.js]
|
||||
var x = 1;
|
||||
x = 2;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/newLineFlagWithCRLF.ts ===
|
||||
var x=1;
|
||||
>x : Symbol(x, Decl(newLineFlagWithCRLF.ts, 0, 3))
|
||||
|
||||
x=2;
|
||||
>x : Symbol(x, Decl(newLineFlagWithCRLF.ts, 0, 3))
|
||||
|
||||
|
||||
=== tests/cases/compiler/newLineFlagWithCRLF.ts ===
|
||||
var x=1;
|
||||
>x : Symbol(x, Decl(newLineFlagWithCRLF.ts, 0, 3))
|
||||
|
||||
x=2;
|
||||
>x : Symbol(x, Decl(newLineFlagWithCRLF.ts, 0, 3))
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
=== tests/cases/compiler/newLineFlagWithCRLF.ts ===
|
||||
var x=1;
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
x=2;
|
||||
>x=2 : number
|
||||
>x : number
|
||||
>2 : number
|
||||
|
||||
|
||||
=== tests/cases/compiler/newLineFlagWithCRLF.ts ===
|
||||
var x=1;
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
x=2;
|
||||
>x=2 : number
|
||||
>x : number
|
||||
>2 : number
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//// [newLineFlagWithLF.ts]
|
||||
//// [newLineFlagWithLF.ts]
|
||||
var x=1;
|
||||
x=2;
|
||||
|
||||
|
||||
|
||||
//// [newLineFlagWithLF.js]
|
||||
|
||||
|
||||
//// [newLineFlagWithLF.js]
|
||||
var x = 1;
|
||||
x = 2;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/newLineFlagWithLF.ts ===
|
||||
var x=1;
|
||||
>x : Symbol(x, Decl(newLineFlagWithLF.ts, 0, 3))
|
||||
|
||||
x=2;
|
||||
>x : Symbol(x, Decl(newLineFlagWithLF.ts, 0, 3))
|
||||
|
||||
|
||||
=== tests/cases/compiler/newLineFlagWithLF.ts ===
|
||||
var x=1;
|
||||
>x : Symbol(x, Decl(newLineFlagWithLF.ts, 0, 3))
|
||||
|
||||
x=2;
|
||||
>x : Symbol(x, Decl(newLineFlagWithLF.ts, 0, 3))
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
=== tests/cases/compiler/newLineFlagWithLF.ts ===
|
||||
var x=1;
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
x=2;
|
||||
>x=2 : number
|
||||
>x : number
|
||||
>2 : number
|
||||
|
||||
|
||||
=== tests/cases/compiler/newLineFlagWithLF.ts ===
|
||||
var x=1;
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
x=2;
|
||||
>x=2 : number
|
||||
>x : number
|
||||
>2 : number
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
//// [noEmitHelpers.ts]
|
||||
//// [noEmitHelpers.ts]
|
||||
|
||||
class A { }
|
||||
class B extends A { }
|
||||
|
||||
|
||||
//// [noEmitHelpers.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
})(A);
|
||||
|
||||
|
||||
//// [noEmitHelpers.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
})(A);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
=== tests/cases/compiler/noEmitHelpers.ts ===
|
||||
|
||||
class A { }
|
||||
>A : Symbol(A, Decl(noEmitHelpers.ts, 0, 0))
|
||||
|
||||
class B extends A { }
|
||||
>B : Symbol(B, Decl(noEmitHelpers.ts, 1, 11))
|
||||
>A : Symbol(A, Decl(noEmitHelpers.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/noEmitHelpers.ts ===
|
||||
|
||||
class A { }
|
||||
>A : Symbol(A, Decl(noEmitHelpers.ts, 0, 0))
|
||||
|
||||
class B extends A { }
|
||||
>B : Symbol(B, Decl(noEmitHelpers.ts, 1, 11))
|
||||
>A : Symbol(A, Decl(noEmitHelpers.ts, 0, 0))
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
=== tests/cases/compiler/noEmitHelpers.ts ===
|
||||
|
||||
class A { }
|
||||
>A : A
|
||||
|
||||
class B extends A { }
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
=== tests/cases/compiler/noEmitHelpers.ts ===
|
||||
|
||||
class A { }
|
||||
>A : A
|
||||
|
||||
class B extends A { }
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
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(4,5): error TS2502: 'd' 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 (7 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;
|
||||
~
|
||||
!!! error TS2502: 'd' is referenced directly or indirectly in its own type annotation.
|
||||
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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
7
tests/cases/compiler/exportDefaultVariable.ts
Normal file
7
tests/cases/compiler/exportDefaultVariable.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
// Regression test for #3018
|
||||
|
||||
declare var io: any;
|
||||
|
||||
declare module 'module' {
|
||||
export default io;
|
||||
}
|
||||
@@ -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;
|
||||
@@ -1,5 +1,4 @@
|
||||
// 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;
|
||||
@@ -7,7 +6,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;
|
||||
@@ -16,6 +14,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;
|
||||
@@ -48,6 +47,6 @@ 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;
|
||||
Reference in New Issue
Block a user