mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-01 21:00:17 -06:00
Condense all error spans to just the name for variable, class, interface, module, enum and enum member
This commit is contained in:
parent
3580a999c8
commit
585d9bdc5f
@ -71,6 +71,7 @@ module ts {
|
||||
}
|
||||
|
||||
export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic {
|
||||
node = getErrorSpanForNode(node);
|
||||
var file = getSourceFileOfNode(node);
|
||||
var start = skipTrivia(file.text, node.pos);
|
||||
var length = node.end - start;
|
||||
@ -79,18 +80,33 @@ module ts {
|
||||
}
|
||||
|
||||
export function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): Diagnostic {
|
||||
node = getErrorSpanForNode(node);
|
||||
var file = getSourceFileOfNode(node);
|
||||
var start = skipTrivia(file.text, node.pos);
|
||||
var length = node.end - start;
|
||||
return flattenDiagnosticChain(file, start, length, messageChain);
|
||||
}
|
||||
|
||||
export function getErrorSpanForNode(node: Node): TextRange {
|
||||
var errorSpan: TextRange;
|
||||
export function getErrorSpanForNode(node: Node): Node {
|
||||
var errorSpan: Node;
|
||||
switch (node.kind) {
|
||||
// This list is a work in progress. Add missing node kinds to improve their error
|
||||
// spans.
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.EnumMember:
|
||||
errorSpan = (<Declaration>node).name;
|
||||
break;
|
||||
}
|
||||
|
||||
// We now have the ideal error span, but it may be a node that is optional and absent
|
||||
// (e.g. the name of a function expression), in which case errorSpan will be undefined.
|
||||
// Alternatively, it might be required and missing (e.g. the name of a module), in which
|
||||
// case its pos will equal its end (length 0). In either of these cases, we should fall
|
||||
// back to the original node that the error was issued on.
|
||||
return errorSpan && errorSpan.pos < errorSpan.end ? errorSpan : node;
|
||||
}
|
||||
|
||||
@ -3150,9 +3166,9 @@ module ts {
|
||||
var firstExternalModule = forEach(files, f => isExternalModule(f) ? f : undefined);
|
||||
if (firstExternalModule && options.module === ModuleKind.None) {
|
||||
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
|
||||
var externalModuleIndicatorNode = firstExternalModule.externalModuleIndicator;
|
||||
var errorStart = skipTrivia(firstExternalModule.text, externalModuleIndicatorNode.pos);
|
||||
var errorLength = externalModuleIndicatorNode.end - errorStart;
|
||||
var externalModuleErrorSpan = getErrorSpanForNode(firstExternalModule.externalModuleIndicator);
|
||||
var errorStart = skipTrivia(firstExternalModule.text, externalModuleErrorSpan.pos);
|
||||
var errorLength = externalModuleErrorSpan.end - errorStart;
|
||||
errors.push(createFileDiagnostic(firstExternalModule, errorStart, errorLength, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided));
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
==== tests/cases/compiler/ExportAssignment7.ts (3 errors) ====
|
||||
export class C {
|
||||
~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
}
|
||||
|
||||
export = B;
|
||||
~~~~~~~~~~~
|
||||
|
||||
@ -1,33 +1,20 @@
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts (1 errors) ====
|
||||
export module A {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
export interface Point {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
x: number;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
y: number;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
|
||||
|
||||
export module Utils {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export function mirror<T extends Point>(p: T) {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
return { x: p.y, y: p.x };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
|
||||
|
||||
export var Origin: Point = { x: 0, y: 0 };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/part2.ts (3 errors) ====
|
||||
export module A {
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
function foof(bar: any): any { return bar };
|
||||
var x: number = foof("s", null);
|
||||
var y: string = foof("s", null);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
|
||||
function foof2(bar: string, x): string;
|
||||
@ -12,5 +12,5 @@
|
||||
function foof2(bar: any): any { return bar };
|
||||
var x2: string = foof2("s", null);
|
||||
var y2: number = foof2("s", null);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
@ -45,19 +45,19 @@
|
||||
var arr_c3: C3[] = [];
|
||||
|
||||
var i1_error: I1 = []; // should be an error - is
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! Type 'undefined[]' is not assignable to type 'I1':
|
||||
!!! Property 'IM1' is missing in type 'undefined[]'.
|
||||
var c1_error: C1 = []; // should be an error - is
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! Type 'undefined[]' is not assignable to type 'C1':
|
||||
!!! Property 'IM1' is missing in type 'undefined[]'.
|
||||
var c2_error: C2 = []; // should be an error - is
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! Type 'undefined[]' is not assignable to type 'C2':
|
||||
!!! Property 'C2M1' is missing in type 'undefined[]'.
|
||||
var c3_error: C3 = []; // should be an error - is
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! Type 'undefined[]' is not assignable to type 'C3':
|
||||
!!! Property 'CM3M1' is missing in type 'undefined[]'.
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
public onEnter(line:string, state:IState, offset:number):IAction {
|
||||
var lineTokens:ILineTokens= this.tokenize(line, state, true);
|
||||
var tokens:IStateToken[]= lineTokens.tokens;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Type 'IToken[]' is not assignable to type 'IStateToken[]':
|
||||
!!! Type 'IToken' is not assignable to type 'IStateToken':
|
||||
!!! Property 'state' is missing in type 'IToken'.
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
}
|
||||
var myVar: myInt;
|
||||
var strArray: string[] = [myVar.voidFn()];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! Type 'void[]' is not assignable to type 'string[]':
|
||||
!!! Type 'void' is not assignable to type 'string'.
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
!!! '=' expected.
|
||||
~
|
||||
!!! Expression expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~
|
||||
!!! Type 'number' is not assignable to type '{ (arrayLength?: number): any[]; <T>(arrayLength: number): T[]; <T>(...items: T[]): T[]; new (arrayLength?: number): any[]; new <T>(arrayLength: number): T[]; new <T>(...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }':
|
||||
!!! Property 'isArray' is missing in type 'Number'.
|
||||
var xs4: typeof Array<typeof x>;
|
||||
@ -17,5 +17,5 @@
|
||||
!!! '=' expected.
|
||||
~
|
||||
!!! Expression expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~
|
||||
!!! Type 'number' is not assignable to type '{ (arrayLength?: number): any[]; <T>(arrayLength: number): T[]; <T>(...items: T[]): T[]; new (arrayLength?: number): any[]; new <T>(arrayLength: number): T[]; new <T>(...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }'.
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/assignmentCompatBug2.ts (5 errors) ====
|
||||
var b2: { b: number;} = { a: 0 }; // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type '{ a: number; }' is not assignable to type '{ b: number; }':
|
||||
!!! Property 'b' is missing in type '{ a: number; }'.
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
var a = { toString: 5 };
|
||||
var b: {} = a; // ok
|
||||
var c: Object = a; // should be error
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type '{ toString: number; }' is not assignable to type 'Object':
|
||||
!!! Types of property 'toString' are incompatible:
|
||||
!!! Type 'number' is not assignable to type '() => string'.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/assignmentToObjectAndFunction.ts (3 errors) ====
|
||||
var errObj: Object = { toString: 0 }; // Error, incompatible toString
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Type '{ toString: number; }' is not assignable to type 'Object':
|
||||
!!! Types of property 'toString' are incompatible:
|
||||
!!! Type 'number' is not assignable to type '() => string'.
|
||||
@ -11,7 +11,7 @@
|
||||
}; // Ok, because toString is a subtype of Object's toString
|
||||
|
||||
var errFun: Function = {}; // Error for no call signature
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Type '{}' is not assignable to type 'Function':
|
||||
!!! Property 'apply' is missing in type '{}'.
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
var badFundule: Function = bad; // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~
|
||||
!!! Type 'typeof bad' is not assignable to type 'Function':
|
||||
!!! Types of property 'apply' are incompatible:
|
||||
!!! Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'.
|
||||
@ -14,19 +14,15 @@
|
||||
var f = () => { };
|
||||
|
||||
var v1: {
|
||||
~~~~~
|
||||
[n: number]: Foo
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
} = o; // Should be allowed
|
||||
~~~~~
|
||||
~~
|
||||
!!! Type '{}' is not assignable to type '{ [x: number]: Foo; }':
|
||||
!!! Index signature is missing in type '{}'.
|
||||
[n: number]: Foo
|
||||
} = o; // Should be allowed
|
||||
|
||||
var v2: {
|
||||
~~~~~
|
||||
[n: number]: Bar
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
} = f; // Should be allowed
|
||||
~~~~~
|
||||
~~
|
||||
!!! Type '() => void' is not assignable to type '{ [x: number]: Bar; }':
|
||||
!!! Index signature is missing in type '() => void'.
|
||||
!!! Index signature is missing in type '() => void'.
|
||||
[n: number]: Bar
|
||||
} = f; // Should be allowed
|
||||
@ -9,8 +9,8 @@
|
||||
|
||||
var c = new C();
|
||||
var r: string = c['foo'](1);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
var r2: number = c['foo']('');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
@ -1,12 +1,12 @@
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItself.ts (3 errors) ====
|
||||
class C extends C { } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'C' recursively references itself as a base type.
|
||||
|
||||
class D<T> extends D<T> { } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'D<T>' recursively references itself as a base type.
|
||||
|
||||
class E<T> extends E<string> { } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'E<T>' recursively references itself as a base type.
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts (2 errors) ====
|
||||
class C extends E { foo: string; } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'C' recursively references itself as a base type.
|
||||
|
||||
class D extends C { bar: string; }
|
||||
@ -8,7 +8,7 @@
|
||||
class E extends D { baz: number; }
|
||||
|
||||
class C2<T> extends E2<T> { foo: T; } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'C2<T>' recursively references itself as a base type.
|
||||
|
||||
class D2<T> extends C2<T> { bar: T; }
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts (2 errors) ====
|
||||
class C extends N.E { foo: string; } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'C' recursively references itself as a base type.
|
||||
|
||||
module M {
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
module O {
|
||||
class C2<T> extends Q.E2<T> { foo: T; } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'C2<T>' recursively references itself as a base type.
|
||||
|
||||
module P {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly_file1.ts (1 errors) ====
|
||||
class C extends E { foo: string; } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'C' recursively references itself as a base type.
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly_file2.ts (0 errors) ====
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly_file4.ts (1 errors) ====
|
||||
class C2<T> extends E2<T> { foo: T; } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'C2<T>' recursively references itself as a base type.
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly_file5.ts (0 errors) ====
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
==== tests/cases/compiler/classInheritence.ts (1 errors) ====
|
||||
class B extends A { }
|
||||
class A extends A { }
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'A' recursively references itself as a base type.
|
||||
@ -6,23 +6,15 @@
|
||||
log(msg?: any): void;
|
||||
};
|
||||
export class Test1 {
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
constructor(private field1: string) {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
messageHandler = () => {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
console.log(field1); // But this should be error as the field1 will resolve to var field1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor.
|
||||
// but since this code would be generated inside constructor, in generated js
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// it would resolve to private field1 and thats not what user intended here.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
};
|
||||
~~~~~~
|
||||
}
|
||||
~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
}
|
||||
@ -15,9 +15,9 @@
|
||||
}
|
||||
|
||||
var r1: typeof A = B; // error
|
||||
~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'typeof B' is not assignable to type 'typeof A'.
|
||||
var r2: new (x: string) => A = B; // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'typeof B' is not assignable to type 'new (x: string) => A'.
|
||||
var r3: typeof A = C; // ok
|
||||
@ -18,7 +18,7 @@
|
||||
~~~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
var _super = 10; // Should be error
|
||||
~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.
|
||||
return 10;
|
||||
}
|
||||
@ -26,7 +26,7 @@
|
||||
~~~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
var _super = 10; // Should be error
|
||||
~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.
|
||||
}
|
||||
}
|
||||
@ -36,7 +36,7 @@
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
var x = () => {
|
||||
var _super = 10; // Should be error
|
||||
~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.
|
||||
}
|
||||
return 10;
|
||||
@ -46,7 +46,7 @@
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
var x = () => {
|
||||
var _super = 10; // Should be error
|
||||
~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
constructor() {
|
||||
super();
|
||||
var _super = 10; // Should be error
|
||||
~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,7 @@
|
||||
super();
|
||||
var x = () => {
|
||||
var _super = 10; // Should be error
|
||||
~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
class b extends Foo {
|
||||
public foo() {
|
||||
var _super = 10; // Should be error
|
||||
~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,7 @@
|
||||
public foo() {
|
||||
var x = () => {
|
||||
var _super = 10; // Should be error
|
||||
~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
public prop2 = {
|
||||
doStuff: () => {
|
||||
var _super = 10; // Should be error
|
||||
~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
return x, y;
|
||||
}
|
||||
var resultIsString: number = foo(1, "123"); //error here
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
|
||||
//TypeParameters
|
||||
@ -13,6 +13,6 @@
|
||||
var x: T1;
|
||||
var y: T2;
|
||||
var result: T1 = (x, y); //error here
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Type 'T2' is not assignable to type 'T1'.
|
||||
}
|
||||
@ -1,11 +1,9 @@
|
||||
==== tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts (2 errors) ====
|
||||
class S18<B, A, C> extends S18<A[], { S19: A; (): A }[], C[]>
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
{
|
||||
~
|
||||
}
|
||||
~
|
||||
~~~
|
||||
!!! Type 'S18<B, A, C>' recursively references itself as a base type.
|
||||
{
|
||||
}
|
||||
(new S18(123)).S18 = 0;
|
||||
~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/conditionalExpression1.ts (2 errors) ====
|
||||
var x: boolean = (true ? 1 : ""); // should be an error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type '{}' is not assignable to type 'boolean'.
|
||||
~~~~~~~~~~~~~
|
||||
!!! No best common type exists between 'number' and 'string'.
|
||||
@ -19,30 +19,30 @@
|
||||
|
||||
//Be contextually typed and and bct is not identical
|
||||
var result2: A = true ? a : b;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! Type '{}' is not assignable to type 'A':
|
||||
!!! Property 'propertyA' is missing in type '{}'.
|
||||
~~~~~~~~~~~~
|
||||
!!! No best common type exists between 'A', 'A', and 'B'.
|
||||
var result3: B = true ? a : b;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! Type '{}' is not assignable to type 'B':
|
||||
!!! Property 'propertyB' is missing in type '{}'.
|
||||
~~~~~~~~~~~~
|
||||
!!! No best common type exists between 'B', 'A', and 'B'.
|
||||
|
||||
var result4: (t: X) => number = true ? (m) => m.propertyX1 : (n) => n.propertyX2;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! Type '{}' is not assignable to type '(t: X) => number'.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! No best common type exists between '(t: X) => number', '(m: X) => number', and '(n: X) => string'.
|
||||
var result5: (t: X) => string = true ? (m) => m.propertyX1 : (n) => n.propertyX2;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! Type '{}' is not assignable to type '(t: X) => string'.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! No best common type exists between '(t: X) => string', '(m: X) => number', and '(n: X) => string'.
|
||||
var result6: (t: X) => boolean = true ? (m) => m.propertyX1 : (n) => n.propertyX2;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! Type '{}' is not assignable to type '(t: X) => boolean'.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! No best common type exists between '(t: X) => boolean', '(m: X) => number', and '(n: X) => string'.
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/constructorAsType.ts (1 errors) ====
|
||||
var Person:new () => {name: string;} = function () {return {name:"joe"};};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'.
|
||||
|
||||
var Person2:{new() : {name:string;};};
|
||||
|
||||
@ -233,6 +233,6 @@
|
||||
interface A { x: string; }
|
||||
interface B extends A { }
|
||||
var x: B = { };
|
||||
~~~~~~~~~~
|
||||
~
|
||||
!!! Type '{}' is not assignable to type 'B':
|
||||
!!! Property 'x' is missing in type '{}'.
|
||||
@ -4,7 +4,7 @@
|
||||
}
|
||||
|
||||
var x3: I = [new Date(), 1];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type '{}[]' is not assignable to type 'I':
|
||||
!!! Index signatures are incompatible:
|
||||
!!! Type '{}' is not assignable to type 'Date':
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
}
|
||||
|
||||
var x2: (a: A) => void = true ? (a: C) => a.foo : (b: number) => { };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type '{}' is not assignable to type '(a: A) => void'.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! No best common type exists between '(a: A) => void', '(a: C) => number', and '(b: number) => void'.
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
return null;
|
||||
}
|
||||
var a: D = foo("hi", []);
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type '(x: "hi", items: string[]) => typeof foo' is not assignable to type 'D':
|
||||
!!! Property 'x' is missing in type '(x: "hi", items: string[]) => typeof foo'.
|
||||
|
||||
@ -3,5 +3,5 @@
|
||||
var x: boolean = delete a;
|
||||
var y: any = delete a;
|
||||
var z: number = delete a;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'boolean' is not assignable to type 'number'.
|
||||
@ -1,8 +1,9 @@
|
||||
==== tests/cases/compiler/dontShowCompilerGeneratedMembers.ts (5 errors) ====
|
||||
var f: {
|
||||
~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type '{ <>(): any; x: number; }':
|
||||
!!! Property 'x' is missing in type 'Number'.
|
||||
x: number;
|
||||
~~~~~~~~~~~~~~
|
||||
<-
|
||||
~
|
||||
!!! Type parameter list cannot be empty.
|
||||
@ -10,9 +11,6 @@
|
||||
!!! '(' expected.
|
||||
~
|
||||
!!! Type parameter declaration expected.
|
||||
~~~~~~
|
||||
!!! Type 'number' is not assignable to type '{ <>(): any; x: number; }':
|
||||
!!! Property 'x' is missing in type 'Number'.
|
||||
};
|
||||
~
|
||||
!!! Expression expected.
|
||||
@ -32,30 +32,30 @@
|
||||
|
||||
var b: number = e; // ok
|
||||
var c: string = e;
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type 'string'.
|
||||
var d: boolean = e;
|
||||
~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type 'boolean'.
|
||||
var ee: Date = e;
|
||||
~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'E' is not assignable to type 'Date':
|
||||
!!! Property 'toDateString' is missing in type 'Number'.
|
||||
var f: any = e; // ok
|
||||
var g: void = e;
|
||||
~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type 'void'.
|
||||
var h: Object = e;
|
||||
var i: {} = e;
|
||||
var j: () => {} = e;
|
||||
~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type '() => {}'.
|
||||
var k: Function = e;
|
||||
~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type 'Function':
|
||||
!!! Property 'apply' is missing in type 'Number'.
|
||||
var l: (x: number) => string = e;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type '(x: number) => string'.
|
||||
ac = e;
|
||||
~~
|
||||
@ -66,19 +66,19 @@
|
||||
!!! Type 'E' is not assignable to type 'I':
|
||||
!!! Property 'foo' is missing in type 'Number'.
|
||||
var m: number[] = e;
|
||||
~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type 'number[]':
|
||||
!!! Property 'concat' is missing in type 'Number'.
|
||||
var n: { foo: string } = e;
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type '{ foo: string; }':
|
||||
!!! Property 'foo' is missing in type 'Number'.
|
||||
var o: <T>(x: T) => T = e;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type '<T>(x: T) => T'.
|
||||
var p: Number = e;
|
||||
var q: String = e;
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type 'String':
|
||||
!!! Property 'charAt' is missing in type 'Number'.
|
||||
|
||||
@ -95,10 +95,10 @@
|
||||
~
|
||||
!!! Type 'E' is not assignable to type 'V'.
|
||||
var a: A = e;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type 'A'.
|
||||
var b: B = e;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'E' is not assignable to type 'B'.
|
||||
}
|
||||
}
|
||||
@ -25,24 +25,24 @@
|
||||
var x: WStatic = W;
|
||||
var y: typeof W = W;
|
||||
var z: number = W; // error
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'typeof W' is not assignable to type 'number'.
|
||||
var a: number = W.a;
|
||||
var b: typeof W = W.a; // error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'W' is not assignable to type 'typeof W':
|
||||
!!! Property 'D' is missing in type 'Number'.
|
||||
var c: typeof W.a = W.a;
|
||||
var d: typeof W = 3; // error
|
||||
~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'typeof W'.
|
||||
var e: typeof W.a = 4;
|
||||
var f: WStatic = W.a; // error
|
||||
~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'W' is not assignable to type 'WStatic':
|
||||
!!! Property 'a' is missing in type 'Number'.
|
||||
var g: WStatic = 5; // error
|
||||
~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'WStatic'.
|
||||
var h: W = 3;
|
||||
var i: W = W.a;
|
||||
|
||||
@ -24,24 +24,24 @@
|
||||
var x: WStatic = W;
|
||||
var y: typeof W = W;
|
||||
var z: number = W; // error
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'typeof W' is not assignable to type 'number'.
|
||||
var a: number = W.a;
|
||||
var b: typeof W = W.a; // error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'W' is not assignable to type 'typeof W':
|
||||
!!! Property 'a' is missing in type 'Number'.
|
||||
var c: typeof W.a = W.a;
|
||||
var d: typeof W = 3; // error
|
||||
~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'typeof W'.
|
||||
var e: typeof W.a = 4;
|
||||
var f: WStatic = W.a; // error
|
||||
~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'W' is not assignable to type 'WStatic':
|
||||
!!! Property 'a' is missing in type 'Number'.
|
||||
var g: WStatic = 5; // error
|
||||
~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'WStatic'.
|
||||
var h: W = 3;
|
||||
var i: W = W.a;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/errorOnContextuallyTypedReturnType.ts (1 errors) ====
|
||||
var n1: () => boolean = function () { }; // expect an error here
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type '() => void' is not assignable to type '() => boolean':
|
||||
!!! Type 'void' is not assignable to type 'boolean'.
|
||||
var n2: () => boolean = function ():boolean { }; // expect an error here
|
||||
|
||||
@ -33,71 +33,71 @@
|
||||
}
|
||||
|
||||
var aNumber: number = 'this is a string';
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
var aString: string = 9.9;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
var aDate: Date = 9.9;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'number' is not assignable to type 'Date':
|
||||
!!! Property 'toDateString' is missing in type 'Number'.
|
||||
|
||||
var aVoid: void = 9.9;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'number' is not assignable to type 'void'.
|
||||
|
||||
var anInterface: I = new D();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~
|
||||
!!! Type 'D<{}>' is not assignable to type 'I':
|
||||
!!! Property 'id' is missing in type 'D<{}>'.
|
||||
var aClass: C = new D();
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Type 'D<{}>' is not assignable to type 'C':
|
||||
!!! Property 'id' is missing in type 'D<{}>'.
|
||||
var aGenericClass: D<string> = new C();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~
|
||||
!!! Type 'C' is not assignable to type 'D<string>':
|
||||
!!! Property 'source' is missing in type 'C'.
|
||||
var anObjectLiteral: I = { id: 'a string' };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Type '{ id: string; }' is not assignable to type 'I':
|
||||
!!! Types of property 'id' are incompatible:
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
var anOtherObjectLiteral: { id: string } = new C();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Type 'C' is not assignable to type '{ id: string; }':
|
||||
!!! Types of property 'id' are incompatible:
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
|
||||
var aFunction: typeof F = F2;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~
|
||||
!!! Type '(x: number) => boolean' is not assignable to type '(x: string) => number':
|
||||
!!! Types of parameters 'x' and 'x' are incompatible:
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
var anOtherFunction: (x: string) => number = F2;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Type '(x: number) => boolean' is not assignable to type '(x: string) => number':
|
||||
!!! Types of parameters 'x' and 'x' are incompatible:
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
var aLambda: typeof F = (x) => 'a string';
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! Type '(x: string) => string' is not assignable to type '(x: string) => number':
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
|
||||
var aModule: typeof M = N;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! Type 'typeof N' is not assignable to type 'typeof M':
|
||||
!!! Types of property 'A' are incompatible:
|
||||
!!! Type 'typeof A' is not assignable to type 'typeof A':
|
||||
!!! Type 'A' is not assignable to type 'A':
|
||||
!!! Property 'name' is missing in type 'A'.
|
||||
var aClassInModule: M.A = new N.A();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Type 'A' is not assignable to type 'A':
|
||||
!!! Property 'name' is missing in type 'A'.
|
||||
var aFunctionInModule: typeof M.F2 = F2;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Type '(x: number) => boolean' is not assignable to type '(x: number) => string':
|
||||
!!! Type 'boolean' is not assignable to type 'string'.
|
||||
|
||||
|
||||
@ -16,11 +16,11 @@
|
||||
|
||||
var d: D = new D();
|
||||
var r: string = d.foo;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
var r2: number = d.foo;
|
||||
|
||||
var r3: string = d.bar();
|
||||
var r4: number = d.bar();
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
@ -5,5 +5,5 @@
|
||||
|
||||
var arr: string[] = [];
|
||||
var x: number = arr.foo();
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
@ -7,5 +7,5 @@
|
||||
|
||||
var arr: string[] = [];
|
||||
var y: number = arr.x;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
@ -11,75 +11,48 @@
|
||||
export class XDate {
|
||||
~~~~~~
|
||||
!!! Statement expected.
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
public getDay():number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
public getXDate():number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
// etc.
|
||||
~~~~~~~~~
|
||||
|
||||
|
||||
// Called as a function
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Not supported anymore? public (): string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
~~~~~
|
||||
// Called as a constructor
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
constructor(year: number, month: number);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
constructor(year: number, month: number, date: number);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
constructor(year: number, month: number, date: number, hours: number);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
constructor(year: number, month: number, date: number, hours: number, minutes: number);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
constructor(year: number, month: number, date: number, hours: number, minutes: number, seconds: number);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
constructor(year: number, month: number, date: number, hours: number, minutes: number, seconds: number, ms: number);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
constructor(value: number);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
constructor();
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Constructor implementation expected.
|
||||
|
||||
~~~~~
|
||||
static parse(string: string): number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
static UTC(year: number, month: number): number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
static UTC(year: number, month: number, date: number): number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
static UTC(year: number, month: number, date: number, hours: number): number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
static UTC(year: number, month: number, date: number, hours: number, minutes: number): number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number): number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number,
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
ms: number): number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
static now(): number;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Function implementation expected.
|
||||
}
|
||||
~~~~~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
}
|
||||
~
|
||||
!!! Declaration or statement expected.
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
// Not on line 0 because we want to verify the error is placed in the appropriate location.
|
||||
export module M {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
}
|
||||
@ -15,7 +15,7 @@
|
||||
!!! Variable declarations of a 'for' statement must be of types 'string' or 'any'.
|
||||
|
||||
for (var idx : number in {}) { }
|
||||
~~~~~~~~~~~~
|
||||
~~~
|
||||
!!! Variable declarations of a 'for' statement cannot use a type annotation.
|
||||
|
||||
function fn(): void { }
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
==== tests/cases/compiler/forIn.ts (2 errors) ====
|
||||
var arr = null;
|
||||
for (var i:number in arr) { // error
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Variable declarations of a 'for' statement cannot use a type annotation.
|
||||
var x1 = arr[i];
|
||||
var y1 = arr[i];
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/forInStatement4.ts (1 errors) ====
|
||||
var expr: any;
|
||||
for (var a: number in expr) {
|
||||
~~~~~~~~~
|
||||
~
|
||||
!!! Variable declarations of a 'for' statement cannot use a type annotation.
|
||||
}
|
||||
@ -9,7 +9,7 @@
|
||||
var parsers: Parsers;
|
||||
var c: ParserFunc = parsers.raw; // ok!
|
||||
var d: ParserFunc = parsers.readline; // not ok
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type '(delimiter?: string) => ParserFunc' is not assignable to type 'ParserFunc':
|
||||
!!! Types of parameters 'delimiter' and 'eventEmitter' are incompatible:
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
==== tests/cases/compiler/genericArrayExtenstions.ts (2 errors) ====
|
||||
export declare class ObservableArray<T> implements Array<T> { // MS.Entertainment.ObservableArray
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Class 'ObservableArray<T>' incorrectly implements interface 'T[]':
|
||||
!!! Property 'join' is missing in type 'ObservableArray<T>'.
|
||||
concat<U extends T[]>(...items: U[]): T[];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
concat(...items: T[]): T[];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/genericArrayMethods1.ts (1 errors) ====
|
||||
var x:string[] = [0,1].slice(0); // this should be an error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number[]' is not assignable to type 'string[]':
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
class A<T> implements Comparable<T> { compareTo(other: T) { return 1; } }
|
||||
var z = { x: new A<number>() };
|
||||
var a1: I<string> = { x: new A<number>() };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type '{ x: A<number>; }' is not assignable to type 'I<string>':
|
||||
!!! Types of property 'x' are incompatible:
|
||||
!!! Type 'A<number>' is not assignable to type 'Comparable<string>':
|
||||
@ -20,11 +20,7 @@
|
||||
!!! Types of parameters 'other' and 'other' are incompatible:
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
var a2: I<string> = function (): { x: A<number> } {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var z = { x: new A<number>() }; return z;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
} ();
|
||||
~~~~
|
||||
~~
|
||||
!!! Type '{ x: A<number>; }' is not assignable to type 'I<string>':
|
||||
!!! Types of property 'x' are incompatible:
|
||||
!!! Type 'A<number>' is not assignable to type 'Comparable<string>':
|
||||
@ -32,8 +28,10 @@
|
||||
!!! Type '(other: number) => number' is not assignable to type '(other: string) => number':
|
||||
!!! Types of parameters 'other' and 'other' are incompatible:
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
var z = { x: new A<number>() }; return z;
|
||||
} ();
|
||||
var a3: I<string> = z;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type '{ x: A<number>; }' is not assignable to type 'I<string>':
|
||||
!!! Types of property 'x' are incompatible:
|
||||
!!! Type 'A<number>' is not assignable to type 'Comparable<string>':
|
||||
@ -42,7 +40,7 @@
|
||||
!!! Types of parameters 'other' and 'other' are incompatible:
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
var a4: I<string> = <K<number>>z;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'K<number>' is not assignable to type 'I<string>':
|
||||
!!! Types of property 'x' are incompatible:
|
||||
!!! Type 'A<number>' is not assignable to type 'Comparable<string>':
|
||||
|
||||
@ -26,6 +26,6 @@
|
||||
var d = r2[1];
|
||||
var e = r2['1'];
|
||||
var u: U = r2[1]; // ok
|
||||
~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'T' is not assignable to type 'U'.
|
||||
}
|
||||
@ -14,6 +14,6 @@
|
||||
var b: MyList<any> = a.clone(); // ok
|
||||
var c: MyList<string> = a.clone(); // bug was there was an error on this line
|
||||
var d: MyList<number> = a.clone(); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'MyList<string>' is not assignable to type 'MyList<number>':
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
@ -10,5 +10,5 @@
|
||||
|
||||
var c = new C<number>();
|
||||
var r: string = c.x;
|
||||
~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
@ -12,5 +12,5 @@
|
||||
|
||||
var c = new C<number>();
|
||||
var r: string = c.x;
|
||||
~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'A<number>' is not assignable to type 'string'.
|
||||
@ -2,11 +2,11 @@
|
||||
class A<T> { foo(x: T) { }}
|
||||
var foo = new A<number>();
|
||||
var r: A<string> = <A<number>>new A(); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'A<number>' is not assignable to type 'A<string>':
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
var r2: A<number> = <A<A<number>>>foo; // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'A<A<number>>' is not assignable to type 'A<number>':
|
||||
!!! Type 'A<number>' is not assignable to type 'number'.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -9,14 +9,14 @@
|
||||
var foo = new A<number>();
|
||||
var r: A<string> = <B<string>>new B();
|
||||
var r2: A<number> = <B<string>>new B(); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'B<string>' is not assignable to type 'A<number>':
|
||||
!!! Types of property 'foo' are incompatible:
|
||||
!!! Type '(x: string) => void' is not assignable to type '(x: number) => void':
|
||||
!!! Types of parameters 'x' and 'x' are incompatible:
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
var r3: B<number> = <A<number>>new B(); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'A<number>' is not assignable to type 'B<number>':
|
||||
!!! Property 'bar' is missing in type 'A<number>'.
|
||||
var r4: A<number> = <A<number>>new A();
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
}
|
||||
var x = new X<{ a: string }>();
|
||||
var i: I = x; // Should not be allowed -- type of 'f' is incompatible with 'I'
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'X<{ a: string; }>' is not assignable to type 'I':
|
||||
!!! Types of property 'f' are incompatible:
|
||||
!!! Type '(a: { a: string; }) => void' is not assignable to type '(a: { a: number; }) => void':
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
==== tests/cases/compiler/implicitAnyFunctionInvocationWithAnyArguements.ts (7 errors) ====
|
||||
// this should be errors
|
||||
var arg0 = null; // error at "arg0"
|
||||
~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! Variable 'arg0' implicitly has an 'any' type.
|
||||
var anyArray = [null, undefined]; // error at array literal
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! Variable 'anyArray' implicitly has an 'any[]' type.
|
||||
var objL: { v; w; } // error at "y,z"
|
||||
~~
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
==== tests/cases/compiler/implicitAnyWidenToAny.ts (4 errors) ====
|
||||
// these should be errors
|
||||
var x = null; // error at "x"
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Variable 'x' implicitly has an 'any' type.
|
||||
var x1 = undefined; // error at "x1"
|
||||
~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Variable 'x1' implicitly has an 'any' type.
|
||||
var widenArray = [null, undefined]; // error at "widenArray"
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~
|
||||
!!! Variable 'widenArray' implicitly has an 'any[]' type.
|
||||
var emptyArray = []; // error at "emptyArray"
|
||||
~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~
|
||||
!!! Variable 'emptyArray' implicitly has an 'any[]' type.
|
||||
|
||||
// these should not be error
|
||||
|
||||
@ -8,10 +8,8 @@
|
||||
|
||||
==== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts (1 errors) ====
|
||||
export module m {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
export function foo() { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
export function foo() { }
|
||||
}
|
||||
|
||||
@ -9,6 +9,6 @@
|
||||
var v1: I1<boolean>;
|
||||
|
||||
var v2: I1<number> = v1;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'I1<boolean>' is not assignable to type 'I1<number>':
|
||||
!!! Type 'boolean' is not assignable to type 'number'.
|
||||
@ -89,7 +89,7 @@
|
||||
}
|
||||
|
||||
var o1: { a: { a: string; }; b: string; } = { e: 0, f: 0 };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }':
|
||||
!!! Property 'a' is missing in type '{ e: number; f: number; }'.
|
||||
|
||||
@ -98,10 +98,10 @@
|
||||
|
||||
|
||||
var i1c1: { (): string; } = 5;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! Type 'number' is not assignable to type '() => string'.
|
||||
|
||||
var fp1: () =>any = a => 0;
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~
|
||||
!!! Type '(a: any) => number' is not assignable to type '() => any'.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
==== tests/cases/compiler/indirectSelfReference.ts (1 errors) ====
|
||||
class a extends b{ }
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'a' recursively references itself as a base type.
|
||||
class b extends a{ }
|
||||
@ -1,5 +1,5 @@
|
||||
==== tests/cases/compiler/indirectSelfReferenceGeneric.ts (1 errors) ====
|
||||
class a<T> extends b<T> { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'a<T>' recursively references itself as a base type.
|
||||
class b<T> extends a<T> { }
|
||||
@ -16,7 +16,7 @@
|
||||
}
|
||||
|
||||
interface D extends A, B, C { } // error because m is not a subtype of {a;}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Property 'm' of type '{}' is not assignable to string index type '{ a: any; }'.
|
||||
|
||||
interface E {
|
||||
@ -24,17 +24,17 @@
|
||||
}
|
||||
|
||||
interface F extends A, B, E { } // error because 0 is not a subtype of {a; b;}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Property '0' of type '{}' is not assignable to numeric index type '{ a: any; b: any; }'.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Property '0' of type '{}' is not assignable to string index type '{ a: any; }'.
|
||||
|
||||
interface G extends A, B, C, E { } // should only report one error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Property '0' of type '{}' is not assignable to numeric index type '{ a: any; b: any; }'.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Property '0' of type '{}' is not assignable to string index type '{ a: any; }'.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Property 'm' of type '{}' is not assignable to string index type '{ a: any; }'.
|
||||
|
||||
interface H extends A, F { } // Should report no error at all because error is internal to F
|
||||
@ -17,7 +17,7 @@
|
||||
[s: number]: {};
|
||||
}
|
||||
interface E extends A, D { } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Numeric index type '{}' is not assignable to string index type '{ a: any; }'.
|
||||
|
||||
interface F extends A, D {
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
// this line should raise an error
|
||||
// otherwise, there's a bug in overload resolution / partial typechecking
|
||||
var k: string = 10;
|
||||
~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
}
|
||||
);
|
||||
|
||||
@ -110,19 +110,19 @@
|
||||
p7: function (pa1, pa2):any { return 0; }
|
||||
};
|
||||
var obj2: i1 = new Object();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! Type 'Object' is not assignable to type 'i1':
|
||||
!!! Property 'p' is missing in type 'Object'.
|
||||
var obj3: i1 = new obj0;
|
||||
~~~~~~~~
|
||||
!!! Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
var obj4: i1 = new Base;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! Type 'Base' is not assignable to type 'i1':
|
||||
!!! Property 'p' is missing in type 'Base'.
|
||||
var obj5: i1 = null;
|
||||
var obj6: i1 = function () { };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! Type '() => void' is not assignable to type 'i1':
|
||||
!!! Property 'p' is missing in type '() => void'.
|
||||
//var obj7: i1 = function foo() { };
|
||||
@ -130,7 +130,7 @@
|
||||
var obj9: i1 = new <i1> anyVar;
|
||||
~
|
||||
!!! Expression expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! Type 'boolean' is not assignable to type 'i1':
|
||||
!!! Property 'p' is missing in type 'Boolean'.
|
||||
~~
|
||||
@ -143,16 +143,16 @@
|
||||
//
|
||||
var obj11: i2;
|
||||
var obj12: i2 = {};
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '{}' is not assignable to type 'i2'.
|
||||
var obj13: i2 = new Object();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Object' is not assignable to type 'i2'.
|
||||
var obj14: i2 = new obj11;
|
||||
~~~~~~~~~
|
||||
!!! Only a void function can be called with the 'new' keyword.
|
||||
var obj15: i2 = new Base;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Base' is not assignable to type 'i2'.
|
||||
var obj16: i2 = null;
|
||||
var obj17: i2 = function ():any { return 0; };
|
||||
@ -161,7 +161,7 @@
|
||||
var obj20: i2 = new <i2> anyVar;
|
||||
~
|
||||
!!! Expression expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'boolean' is not assignable to type 'i2'.
|
||||
~~
|
||||
!!! Cannot find name 'i2'.
|
||||
@ -173,25 +173,25 @@
|
||||
//
|
||||
var obj22: i3;
|
||||
var obj23: i3 = {};
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '{}' is not assignable to type 'i3'.
|
||||
var obj24: i3 = new Object();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Object' is not assignable to type 'i3'.
|
||||
var obj25: i3 = new obj22;
|
||||
var obj26: i3 = new Base;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Base' is not assignable to type 'i3'.
|
||||
var obj27: i3 = null;
|
||||
var obj28: i3 = function () { };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '() => void' is not assignable to type 'i3'.
|
||||
//var obj29: i3 = function foo() { };
|
||||
var obj30: i3 = <i3> anyVar;
|
||||
var obj31: i3 = new <i3> anyVar;
|
||||
~
|
||||
!!! Expression expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'boolean' is not assignable to type 'i3'.
|
||||
~~
|
||||
!!! Cannot find name 'i3'.
|
||||
@ -204,19 +204,19 @@
|
||||
var obj33: i4;
|
||||
var obj34: i4 = {};
|
||||
var obj35: i4 = new Object();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Object' is not assignable to type 'i4':
|
||||
!!! Index signature is missing in type 'Object'.
|
||||
var obj36: i4 = new obj33;
|
||||
~~~~~~~~~
|
||||
!!! Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
var obj37: i4 = new Base;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Base' is not assignable to type 'i4':
|
||||
!!! Index signature is missing in type 'Base'.
|
||||
var obj38: i4 = null;
|
||||
var obj39: i4 = function () { };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '() => void' is not assignable to type 'i4':
|
||||
!!! Index signature is missing in type '() => void'.
|
||||
//var obj40: i4 = function foo() { };
|
||||
@ -224,7 +224,7 @@
|
||||
var obj42: i4 = new <i4> anyVar;
|
||||
~
|
||||
!!! Expression expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'boolean' is not assignable to type 'i4':
|
||||
!!! Index signature is missing in type 'Boolean'.
|
||||
~~
|
||||
@ -237,23 +237,23 @@
|
||||
//
|
||||
var obj44: i5;
|
||||
var obj45: i5 = {};
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '{}' is not assignable to type 'i5':
|
||||
!!! Property 'p' is missing in type '{}'.
|
||||
var obj46: i5 = new Object();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Object' is not assignable to type 'i5':
|
||||
!!! Property 'p' is missing in type 'Object'.
|
||||
var obj47: i5 = new obj44;
|
||||
~~~~~~~~~
|
||||
!!! Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
var obj48: i5 = new Base;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Base' is not assignable to type 'i5':
|
||||
!!! Property 'p' is missing in type 'Base'.
|
||||
var obj49: i5 = null;
|
||||
var obj50: i5 = function () { };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '() => void' is not assignable to type 'i5':
|
||||
!!! Property 'p' is missing in type '() => void'.
|
||||
//var obj51: i5 = function foo() { };
|
||||
@ -261,7 +261,7 @@
|
||||
var obj53: i5 = new <i5> anyVar;
|
||||
~
|
||||
!!! Expression expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'boolean' is not assignable to type 'i5':
|
||||
!!! Property 'p' is missing in type 'Boolean'.
|
||||
~~
|
||||
@ -274,20 +274,20 @@
|
||||
//
|
||||
var obj55: i6;
|
||||
var obj56: i6 = {};
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '{}' is not assignable to type 'i6'.
|
||||
var obj57: i6 = new Object();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Object' is not assignable to type 'i6'.
|
||||
var obj58: i6 = new obj55;
|
||||
~~~~~~~~~
|
||||
!!! Only a void function can be called with the 'new' keyword.
|
||||
var obj59: i6 = new Base;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Base' is not assignable to type 'i6'.
|
||||
var obj60: i6 = null;
|
||||
var obj61: i6 = function () { };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '() => void' is not assignable to type 'i6':
|
||||
!!! Type 'void' is not assignable to type 'number'.
|
||||
//var obj62: i6 = function foo() { };
|
||||
@ -295,7 +295,7 @@
|
||||
var obj64: i6 = new <i6> anyVar;
|
||||
~
|
||||
!!! Expression expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'boolean' is not assignable to type 'i6'.
|
||||
~~
|
||||
!!! Cannot find name 'i6'.
|
||||
@ -307,10 +307,10 @@
|
||||
//
|
||||
var obj66: i7;
|
||||
var obj67: i7 = {};
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '{}' is not assignable to type 'i7'.
|
||||
var obj68: i7 = new Object();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Object' is not assignable to type 'i7'.
|
||||
var obj69: i7 = new obj66;
|
||||
var obj70: i7 = <i7>new Base;
|
||||
@ -318,14 +318,14 @@
|
||||
!!! Neither type 'i7' nor type 'Base' is assignable to the other.
|
||||
var obj71: i7 = null;
|
||||
var obj72: i7 = function () { };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '() => void' is not assignable to type 'i7'.
|
||||
//var obj73: i7 = function foo() { };
|
||||
var obj74: i7 = <i7> anyVar;
|
||||
var obj75: i7 = new <i7> anyVar;
|
||||
~
|
||||
!!! Expression expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'boolean' is not assignable to type 'i7'.
|
||||
~~
|
||||
!!! Cannot find name 'i7'.
|
||||
@ -338,19 +338,19 @@
|
||||
var obj77: i8;
|
||||
var obj78: i8 = {};
|
||||
var obj79: i8 = new Object();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Object' is not assignable to type 'i8':
|
||||
!!! Index signature is missing in type 'Object'.
|
||||
var obj80: i8 = new obj77;
|
||||
~~~~~~~~~
|
||||
!!! Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
var obj81: i8 = new Base;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'Base' is not assignable to type 'i8':
|
||||
!!! Index signature is missing in type 'Base'.
|
||||
var obj82: i8 = null;
|
||||
var obj83: i8 = function () { };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '() => void' is not assignable to type 'i8':
|
||||
!!! Index signature is missing in type '() => void'.
|
||||
//var obj84: i8 = function foo() { };
|
||||
@ -358,7 +358,7 @@
|
||||
var obj86: i8 = new <i8> anyVar;
|
||||
~
|
||||
!!! Expression expected.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type 'boolean' is not assignable to type 'i8':
|
||||
!!! Index signature is missing in type 'Boolean'.
|
||||
~~
|
||||
|
||||
@ -25,12 +25,10 @@
|
||||
}
|
||||
|
||||
interface I5 extends I5 {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
foo():void;
|
||||
~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~
|
||||
!!! Type 'I5' recursively references itself as a base type.
|
||||
foo():void;
|
||||
}
|
||||
|
||||
interface I6 {
|
||||
():void;
|
||||
@ -51,7 +49,7 @@
|
||||
}
|
||||
|
||||
interface i8 extends i9 { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'i8' recursively references itself as a base type.
|
||||
interface i9 extends i8 { }
|
||||
|
||||
|
||||
@ -39,12 +39,10 @@
|
||||
}
|
||||
|
||||
var a:I4 = function(){
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
return new C2();
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~
|
||||
!!! Type '() => C2' is not assignable to type 'I4'.
|
||||
return new C2();
|
||||
}
|
||||
new a();
|
||||
|
||||
/*var b:I4 = C2;
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatIndirectlyInheritsFromItself.ts (2 errors) ====
|
||||
interface Base extends Derived2 { // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
x: string;
|
||||
~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~~~
|
||||
!!! Type 'Base' recursively references itself as a base type.
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface Derived extends Base {
|
||||
y: string;
|
||||
@ -17,12 +15,10 @@
|
||||
|
||||
module Generic {
|
||||
interface Base<T> extends Derived2<T> { // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
x: string;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
~~~~
|
||||
!!! Type 'Base<T>' recursively references itself as a base type.
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface Derived<T> extends Base<T> {
|
||||
y: string;
|
||||
|
||||
@ -1,21 +1,18 @@
|
||||
==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts (8 errors) ====
|
||||
interface Foo extends Foo { // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~~
|
||||
!!! Type 'Foo' recursively references itself as a base type.
|
||||
}
|
||||
|
||||
interface Foo2<T> extends Foo2<T> { // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~~~
|
||||
!!! Type 'Foo2<T>' recursively references itself as a base type.
|
||||
}
|
||||
|
||||
interface Foo3<T> extends Foo3<string> { // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~~~
|
||||
!!! Type 'Foo3<T>' recursively references itself as a base type.
|
||||
}
|
||||
|
||||
interface Bar implements Bar { // error
|
||||
~~~~~~~~~~
|
||||
|
||||
@ -2,35 +2,35 @@
|
||||
var x = true;
|
||||
|
||||
var a: number = x;
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'boolean' is not assignable to type 'number'.
|
||||
var b: string = x;
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'boolean' is not assignable to type 'string'.
|
||||
var c: void = x;
|
||||
~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'boolean' is not assignable to type 'void'.
|
||||
var d: typeof undefined = x;
|
||||
|
||||
enum E { A }
|
||||
var e: E = x;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'boolean' is not assignable to type 'E'.
|
||||
|
||||
class C { foo: string }
|
||||
var f: C = x;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'boolean' is not assignable to type 'C':
|
||||
!!! Property 'foo' is missing in type 'Boolean'.
|
||||
|
||||
interface I { bar: string }
|
||||
var g: I = x;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'boolean' is not assignable to type 'I':
|
||||
!!! Property 'bar' is missing in type 'Boolean'.
|
||||
|
||||
var h: { (): string } = x;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'boolean' is not assignable to type '() => string'.
|
||||
var h2: { toString(): string } = x; // no error
|
||||
|
||||
|
||||
@ -2,34 +2,34 @@
|
||||
var x = 1;
|
||||
|
||||
var a: boolean = x;
|
||||
~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'boolean'.
|
||||
var b: string = x;
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
var c: void = x;
|
||||
~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'void'.
|
||||
var d: typeof undefined = x;
|
||||
|
||||
class C { foo: string; }
|
||||
var e: C = x;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'C':
|
||||
!!! Property 'foo' is missing in type 'Number'.
|
||||
|
||||
interface I { bar: string; }
|
||||
var f: I = x;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'I':
|
||||
!!! Property 'bar' is missing in type 'Number'.
|
||||
|
||||
var g: { baz: string } = 1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type '{ baz: string; }':
|
||||
!!! Property 'baz' is missing in type 'Number'.
|
||||
var g2: { 0: number } = 1;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'number' is not assignable to type '{ 0: number; }':
|
||||
!!! Property '0' is missing in type 'Number'.
|
||||
|
||||
|
||||
@ -2,34 +2,34 @@
|
||||
var x = '';
|
||||
|
||||
var a: boolean = x;
|
||||
~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'string' is not assignable to type 'boolean'.
|
||||
var b: number = x;
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
var c: void = x;
|
||||
~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'string' is not assignable to type 'void'.
|
||||
var d: typeof undefined = x;
|
||||
|
||||
class C { foo: string; }
|
||||
var e: C = x;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'string' is not assignable to type 'C':
|
||||
!!! Property 'foo' is missing in type 'String'.
|
||||
|
||||
interface I { bar: string; }
|
||||
var f: I = x;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'string' is not assignable to type 'I':
|
||||
!!! Property 'bar' is missing in type 'String'.
|
||||
|
||||
var g: { baz: string } = 1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type '{ baz: string; }':
|
||||
!!! Property 'baz' is missing in type 'Number'.
|
||||
var g2: { 0: number } = 1;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'number' is not assignable to type '{ 0: number; }':
|
||||
!!! Property '0' is missing in type 'Number'.
|
||||
|
||||
@ -49,5 +49,5 @@
|
||||
|
||||
enum E { A }
|
||||
var j: E = x;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'string' is not assignable to type 'E'.
|
||||
@ -2,32 +2,32 @@
|
||||
var x: void;
|
||||
|
||||
var a: boolean = x;
|
||||
~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'void' is not assignable to type 'boolean'.
|
||||
var b: string = x;
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'void' is not assignable to type 'string'.
|
||||
var c: number = x;
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'void' is not assignable to type 'number'.
|
||||
var d: typeof undefined = x;
|
||||
|
||||
class C { foo: string; }
|
||||
var e: C = x;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'void' is not assignable to type 'C'.
|
||||
|
||||
interface I { bar: string; }
|
||||
var f: I = x;
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! Type 'void' is not assignable to type 'I'.
|
||||
|
||||
var g: { baz: string } = 1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'number' is not assignable to type '{ baz: string; }':
|
||||
!!! Property 'baz' is missing in type 'Number'.
|
||||
var g2: { 0: number } = 1;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'number' is not assignable to type '{ 0: number; }':
|
||||
!!! Property '0' is missing in type 'Number'.
|
||||
|
||||
|
||||
@ -9,5 +9,5 @@
|
||||
}
|
||||
|
||||
var n: number = x.a;
|
||||
~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
@ -1,23 +1,15 @@
|
||||
==== tests/cases/compiler/mergedModuleDeclarationCodeGen.ts (1 errors) ====
|
||||
export module X {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
export module Y {
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
class A {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
constructor(Y: any) {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
new B();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
}
|
||||
~
|
||||
~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
export module Y {
|
||||
class A {
|
||||
constructor(Y: any) {
|
||||
new B();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
export module X {
|
||||
export module Y {
|
||||
export class B {
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
var m = [1, 2, 3, 4, 5];
|
||||
// Should yield an implicit 'any' error.
|
||||
var n = [[]] || [];
|
||||
~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Variable 'n' implicitly has an 'any[][]' type.
|
||||
|
||||
for (n[idx++] in m);
|
||||
|
||||
@ -97,51 +97,32 @@
|
||||
|
||||
// error
|
||||
var b: { [x: number]: string; } = {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type '{ [x: number]: {}; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: unknown; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }':
|
||||
!!! Index signatures are incompatible:
|
||||
!!! Type '{}' is not assignable to type 'string'.
|
||||
a: '',
|
||||
~~~~~~~~~~
|
||||
b: 1,
|
||||
~~~~~~~~~~
|
||||
c: () => { },
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
"d": '',
|
||||
~~~~~~~~~~~~~
|
||||
"e": 1,
|
||||
~~~~~~~~~~~~
|
||||
1.0: '',
|
||||
~~~~~~~~~~~~
|
||||
2.0: 1,
|
||||
~~~~~~~~~~~~
|
||||
"3.0": '',
|
||||
~~~~~~~~~~~~~~~
|
||||
"4.0": 1,
|
||||
~~~~~~~~~~~~~~
|
||||
f: <Myn>null,
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
~~~
|
||||
!!! Cannot find name 'Myn'.
|
||||
|
||||
|
||||
get X() {
|
||||
~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~~~~~~~~~~~~
|
||||
return '';
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
},
|
||||
~~~~~~
|
||||
set X(v) { },
|
||||
~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
foo() {
|
||||
~~~~~~~~~~~~
|
||||
return '';
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
}
|
||||
~
|
||||
!!! Type '{ [x: number]: {}; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: unknown; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }':
|
||||
!!! Index signatures are incompatible:
|
||||
!!! Type '{}' is not assignable to type 'string'.
|
||||
}
|
||||
@ -50,20 +50,14 @@
|
||||
|
||||
// error
|
||||
var b: { [x: number]: A } = {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
1.0: new A(),
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
2.0: new B(),
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
"2.5": new B(),
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
3.0: 1,
|
||||
~~~~~~~~~~~
|
||||
"4.0": ''
|
||||
~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~
|
||||
!!! Type '{ [x: number]: {}; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }':
|
||||
!!! Index signatures are incompatible:
|
||||
!!! Type '{}' is not assignable to type 'A':
|
||||
!!! Property 'foo' is missing in type '{}'.
|
||||
!!! Property 'foo' is missing in type '{}'.
|
||||
1.0: new A(),
|
||||
2.0: new B(),
|
||||
"2.5": new B(),
|
||||
3.0: 1,
|
||||
"4.0": ''
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
class Foo { foo() { } }
|
||||
var x: { [index: string]: number; };
|
||||
var result: Foo = x["one"]; // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Type 'number' is not assignable to type 'Foo':
|
||||
!!! Property 'foo' is missing in type 'Number'.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/numericIndexerConstraint5.ts (1 errors) ====
|
||||
var x = { name: "x", 0: new Date() };
|
||||
var z: { [name: number]: string } = x;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type '{ 0: Date; name: string; }' is not assignable to type '{ [x: number]: string; }':
|
||||
!!! Index signature is missing in type '{ 0: Date; name: string; }'.
|
||||
@ -8,10 +8,10 @@
|
||||
|
||||
var i: I;
|
||||
var r: string = i[1]; // error: numeric indexer returns the type of the string indexer
|
||||
~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'Date' is not assignable to type 'string'.
|
||||
|
||||
var i2: I2;
|
||||
var r2: string = i2[1]; // error: numeric indexer returns the type of the string indexer
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'Date' is not assignable to type 'string'.
|
||||
@ -8,10 +8,10 @@
|
||||
|
||||
var i: I;
|
||||
var r: string = i[1]; // error: numeric indexer returns the type of the string indexer
|
||||
~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'Date' is not assignable to type 'string'.
|
||||
|
||||
var i2: I2;
|
||||
var r2: string = i2[1]; // error: numeric indexer returns the type of the string indexere
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'Date' is not assignable to type 'string'.
|
||||
@ -1,6 +1,6 @@
|
||||
==== tests/cases/compiler/objectLitStructuralTypeMismatch.ts (1 errors) ====
|
||||
// Shouldn't compile
|
||||
var x: { a: number; } = { b: 5 };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type '{ b: number; }' is not assignable to type '{ a: number; }':
|
||||
!!! Property 'a' is missing in type '{ b: number; }'.
|
||||
@ -12,7 +12,7 @@
|
||||
var c: any;
|
||||
|
||||
var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [x: string]: A; [x: number]: B; }':
|
||||
!!! Index signatures are incompatible:
|
||||
!!! Type 'A' is not assignable to type 'B':
|
||||
|
||||
@ -3,12 +3,10 @@
|
||||
0: string;
|
||||
}
|
||||
var x: A = {
|
||||
~~~~~~~~
|
||||
0: 3
|
||||
~~~~~~~~
|
||||
};
|
||||
~
|
||||
~
|
||||
!!! Type '{ 0: number; }' is not assignable to type 'A':
|
||||
!!! Types of property '0' are incompatible:
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
0: 3
|
||||
};
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
var i2: I2;
|
||||
var c: I1 = i2.p1; // should be ok
|
||||
var d: I1 = i2.m1; // should error
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type '(p1?: string) => I1' is not assignable to type 'I1':
|
||||
!!! Types of parameters 'p1' and 'p1' are incompatible:
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
|
||||
@ -27,11 +27,11 @@
|
||||
interface i4 { M?: number; };
|
||||
|
||||
var test1: i1 = {};
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '{}' is not assignable to type 'i1':
|
||||
!!! Property 'M' is missing in type '{}'.
|
||||
var test2: i3 = {};
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Type '{}' is not assignable to type 'i3':
|
||||
!!! Property 'M' is missing in type '{}'.
|
||||
var test3: i2 = {};
|
||||
|
||||
@ -7,11 +7,10 @@
|
||||
|
||||
declare var v1: I1<number>;
|
||||
var r1: I1<string> = v1.func(num => num.toString()) // Correctly returns an I1<string>
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.func(str => str.length); // should error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! Type 'I1<number>' is not assignable to type 'I1<string>':
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
.func(str => str.length); // should error
|
||||
|
||||
var r2: I1<number> = v1.func(num => num.toString()) // Correctly returns an I1<string>
|
||||
.func(str => str.length); // should be ok
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
declare var x:O.I;
|
||||
|
||||
var e:string=x.g(new O.A()); // matches overload but bad assignment
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Type 'C' is not assignable to type 'string'.
|
||||
var y:string=x.f(3); // good
|
||||
y=x.f("nope"); // can't assign number to string
|
||||
|
||||
@ -21,18 +21,18 @@
|
||||
|
||||
// these are errors
|
||||
var htmlElement2: Derived1 = d2.createElement("yo")
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~
|
||||
!!! Type 'Base' is not assignable to type 'Derived1':
|
||||
!!! Property 'bar' is missing in type 'Base'.
|
||||
var htmlCanvasElement2: Derived3 = d2.createElement("canvas");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! Type 'Derived1' is not assignable to type 'Derived3':
|
||||
!!! Property 'biz' is missing in type 'Derived1'.
|
||||
var htmlDivElement2: Derived1 = d2.createElement("div");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Type 'Derived2' is not assignable to type 'Derived1':
|
||||
!!! Property 'bar' is missing in type 'Derived2'.
|
||||
var htmlSpanElement2: Derived1 = d2.createElement("span");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Type 'Derived3' is not assignable to type 'Derived1':
|
||||
!!! Property 'bar' is missing in type 'Derived3'.
|
||||
@ -13,7 +13,7 @@
|
||||
declare function foo(arg: (x: B) => any): number;
|
||||
|
||||
var result: number = foo(x => new G(x)); // No error, returns number
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (34 errors) ====
|
||||
export class Game {
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
private position = new DisplayPosition([), 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! Expression or comma expected.
|
||||
~
|
||||
@ -68,9 +68,6 @@
|
||||
~
|
||||
!!! Duplicate identifier '0'.
|
||||
private prevConfig: SeedCoords[][];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~
|
||||
!!! Cannot find name 'SeedCoords'.
|
||||
}
|
||||
~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
}
|
||||
@ -1,9 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts (1 errors) ====
|
||||
export class Logger {
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
public
|
||||
~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~~~~~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
public
|
||||
}
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts (1 errors) ====
|
||||
export class Logger {
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
public
|
||||
~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~~~~~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
public
|
||||
}
|
||||
|
||||
@ -2,10 +2,8 @@
|
||||
"use strict";
|
||||
|
||||
export class Logger {
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
public
|
||||
~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~~~~~
|
||||
!!! Cannot compile external modules unless the '--module' flag is provided.
|
||||
public
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user