mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Accept new baselines
This commit is contained in:
@@ -51,7 +51,7 @@ class C extends B {
|
||||
>"edge" : "edge"
|
||||
|
||||
readonly ro = "readonly please";
|
||||
>ro : string
|
||||
>ro : "readonly please"
|
||||
>"readonly please" : "readonly please"
|
||||
|
||||
readonlyProp: string; // don't have to give a value, in fact
|
||||
|
||||
@@ -4,12 +4,12 @@ tests/cases/compiler/assignmentCompatBug2.ts(3,8): error TS2322: Type '{ a: numb
|
||||
Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(5,13): error TS2322: Type '{ b: number; a: number; }' is not assignable to type '{ b: number; }'.
|
||||
Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2322: Type '{ f: (n: number) => 0; g: (s: string) => 0; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
Property 'm' is missing in type '{ f: (n: number) => 0; g: (s: string) => 0; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(20,1): error TS2322: Type '{ f: (n: number) => 0; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
Property 'g' is missing in type '{ f: (n: number) => 0; m: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n: number) => 0; g: (s: string) => 0; n: number; k: (a: any) => any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
Property 'm' is missing in type '{ f: (n: number) => 0; g: (s: string) => 0; n: number; k: (a: any) => any; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(20,1): error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
Property 'g' is missing in type '{ f: (n: number) => number; m: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatBug2.ts (6 errors) ====
|
||||
@@ -38,16 +38,16 @@ tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n:
|
||||
|
||||
b3 = {
|
||||
~~
|
||||
!!! error TS2322: Type '{ f: (n: number) => 0; g: (s: string) => 0; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => 0; g: (s: string) => 0; }'.
|
||||
!!! error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'.
|
||||
f: (n) => { return 0; },
|
||||
g: (s) => { return 0; },
|
||||
}; // error
|
||||
|
||||
b3 = {
|
||||
~~
|
||||
!!! error TS2322: Type '{ f: (n: number) => 0; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
!!! error TS2322: Property 'g' is missing in type '{ f: (n: number) => 0; m: number; }'.
|
||||
!!! error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
!!! error TS2322: Property 'g' is missing in type '{ f: (n: number) => number; m: number; }'.
|
||||
f: (n) => { return 0; },
|
||||
m: 0,
|
||||
}; // error
|
||||
@@ -62,8 +62,8 @@ tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n:
|
||||
|
||||
b3 = {
|
||||
~~
|
||||
!!! error TS2322: Type '{ f: (n: number) => 0; g: (s: string) => 0; n: number; k: (a: any) => any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => 0; g: (s: string) => 0; n: number; k: (a: any) => any; }'.
|
||||
!!! error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }'.
|
||||
f: (n) => { return 0; },
|
||||
g: (s) => { return 0; },
|
||||
n: 0,
|
||||
|
||||
@@ -4,10 +4,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(36,1): error TS2322: Type '(x: string) => void' is not assignable to type 'T'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(37,1): error TS2322: Type '(x: string) => 1' is not assignable to type 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(37,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(38,1): error TS2322: Type '(x: string) => ""' is not assignable to type 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(38,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(39,1): error TS2322: Type 'S2' is not assignable to type '(x: number) => void'.
|
||||
@@ -16,10 +16,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(40,1): error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(41,1): error TS2322: Type '(x: string) => 1' is not assignable to type '(x: number) => void'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(41,1): error TS2322: Type '(x: string) => number' is not assignable to type '(x: number) => void'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(42,1): error TS2322: Type '(x: string) => ""' is not assignable to type '(x: number) => void'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(42,1): error TS2322: Type '(x: string) => string' is not assignable to type '(x: number) => void'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@@ -71,12 +71,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
t = (x: string) => 1;
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => 1' is not assignable to type 'T'.
|
||||
!!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'.
|
||||
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
t = function (x: string) { return ''; }
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => ""' is not assignable to type 'T'.
|
||||
!!! error TS2322: Type '(x: string) => string' is not assignable to type 'T'.
|
||||
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
a = s2;
|
||||
@@ -91,12 +91,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
a = (x: string) => 1;
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => 1' is not assignable to type '(x: number) => void'.
|
||||
!!! error TS2322: Type '(x: string) => number' is not assignable to type '(x: number) => void'.
|
||||
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
a = function (x: string) { return ''; }
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => ""' is not assignable to type '(x: number) => void'.
|
||||
!!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: number) => void'.
|
||||
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(16,5): error TS2322: Type '(x: number) => 1' is not assignable to type '() => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(16,5): error TS2322: Type '(x: number) => number' is not assignable to type '() => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(19,5): error TS2322: Type '(x: number) => number' is not assignable to type '() => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(20,5): error TS2322: Type '(x: number, y?: number) => number' is not assignable to type '() => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(22,5): error TS2322: Type '(x: number, y: number) => number' is not assignable to type '() => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(33,5): error TS2322: Type '(x: number, y: number) => number' is not assignable to type '(x?: number) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(39,5): error TS2322: Type '(x: number, y: number) => 1' is not assignable to type '(x: number) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(39,5): error TS2322: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(45,5): error TS2322: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'.
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
a = (x?: number) => 1; // ok, same number of required params
|
||||
a = (x: number) => 1; // error, too many required params
|
||||
~
|
||||
!!! error TS2322: Type '(x: number) => 1' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type '(x: number) => number' is not assignable to type '() => number'.
|
||||
a = b.a; // ok
|
||||
a = b.a2; // ok
|
||||
a = b.a3; // error
|
||||
@@ -58,7 +58,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
a3 = (x: number) => 1; // ok, same number of required params
|
||||
a3 = (x: number, y: number) => 1; // error, too many required params
|
||||
~~
|
||||
!!! error TS2322: Type '(x: number, y: number) => 1' is not assignable to type '(x: number) => number'.
|
||||
!!! error TS2322: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'.
|
||||
a3 = b.a; // ok
|
||||
a3 = b.a2; // ok
|
||||
a3 = b.a3; // ok
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(13,5): error TS2322: Type '(...args: string[]) => 1' is not assignable to type '(...args: number[]) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(13,5): error TS2322: Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'.
|
||||
Types of parameters 'args' and 'args' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(17,5): error TS2322: Type '(x?: string) => 1' is not assignable to type '(...args: number[]) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(17,5): error TS2322: Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'.
|
||||
Types of parameters 'x' and 'args' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(26,5): error TS2322: Type '(x: number, ...args: string[]) => 1' is not assignable to type '(x: number, ...z: number[]) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(26,5): error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'.
|
||||
Types of parameters 'args' and 'z' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(35,5): error TS2322: Type '(x: number, y?: number, z?: number) => 1' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(35,5): error TS2322: Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
Types of parameters 'y' and 'y' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(36,5): error TS2322: Type '(x: number, ...z: number[]) => 1' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(36,5): error TS2322: Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
Types of parameters 'z' and 'y' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(37,5): error TS2322: Type '(x: string, y?: string, z?: string) => 1' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(37,5): error TS2322: Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(41,5): error TS2322: Type '(x?: number, y?: number) => 1' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(41,5): error TS2322: Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
Types of parameters 'y' and 'y' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(43,5): error TS2322: Type '(x: number, y?: number) => 1' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(43,5): error TS2322: Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
Types of parameters 'y' and 'y' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(45,5): error TS2322: Type '(x: number, ...args: string[]) => 1' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(45,5): error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
Types of parameters 'args' and 'z' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@@ -42,7 +42,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
a = (...args: number[]) => 1; // ok, same number of required params
|
||||
a = (...args: string[]) => 1; // error, type mismatch
|
||||
~
|
||||
!!! error TS2322: Type '(...args: string[]) => 1' is not assignable to type '(...args: number[]) => number'.
|
||||
!!! error TS2322: Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'.
|
||||
!!! error TS2322: Types of parameters 'args' and 'args' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
a = (x?: number) => 1; // ok, same number of required params
|
||||
@@ -50,7 +50,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
a = (x: number) => 1; // ok, rest param corresponds to infinite number of params
|
||||
a = (x?: string) => 1; // error, incompatible type
|
||||
~
|
||||
!!! error TS2322: Type '(x?: string) => 1' is not assignable to type '(...args: number[]) => number'.
|
||||
!!! error TS2322: Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'.
|
||||
!!! error TS2322: Types of parameters 'x' and 'args' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@@ -63,7 +63,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
a2 = (x: number, ...args: number[]) => 1; // ok, same number of required params
|
||||
a2 = (x: number, ...args: string[]) => 1; // should be type mismatch error
|
||||
~~
|
||||
!!! error TS2322: Type '(x: number, ...args: string[]) => 1' is not assignable to type '(x: number, ...z: number[]) => number'.
|
||||
!!! error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'.
|
||||
!!! error TS2322: Types of parameters 'args' and 'z' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
a2 = (x: number, y: number) => 1; // ok, rest param corresponds to infinite number of params
|
||||
@@ -76,17 +76,17 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
a3 = (x: number, y: string) => 1; // ok, all present params match
|
||||
a3 = (x: number, y?: number, z?: number) => 1; // error
|
||||
~~
|
||||
!!! error TS2322: Type '(x: number, y?: number, z?: number) => 1' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
a3 = (x: number, ...z: number[]) => 1; // error
|
||||
~~
|
||||
!!! error TS2322: Type '(x: number, ...z: number[]) => 1' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Types of parameters 'z' and 'y' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
a3 = (x: string, y?: string, z?: string) => 1; // error
|
||||
~~
|
||||
!!! error TS2322: Type '(x: string, y?: string, z?: string) => 1' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@@ -94,18 +94,18 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
a4 = () => 1; // ok, fewer required params
|
||||
a4 = (x?: number, y?: number) => 1; // error, type mismatch
|
||||
~~
|
||||
!!! error TS2322: Type '(x?: number, y?: number) => 1' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
a4 = (x: number) => 1; // ok, all present params match
|
||||
a4 = (x: number, y?: number) => 1; // error, second param has type mismatch
|
||||
~~
|
||||
!!! error TS2322: Type '(x: number, y?: number) => 1' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
a4 = (x?: number, y?: string) => 1; // ok, same number of required params with matching types
|
||||
a4 = (x: number, ...args: string[]) => 1; // error, rest params have type mismatch
|
||||
~~
|
||||
!!! error TS2322: Type '(x: number, ...args: string[]) => 1' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
|
||||
!!! error TS2322: Types of parameters 'args' and 'z' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -3,9 +3,9 @@ var foo:(a:{():number; (i:number):number; })=>number; foo = function(a){return 5
|
||||
>foo : (a: { (): number; (i: number): number; }) => number
|
||||
>a : { (): number; (i: number): number; }
|
||||
>i : number
|
||||
>foo = function(a){return 5} : (a: { (): number; (i: number): number; }) => 5
|
||||
>foo = function(a){return 5} : (a: { (): number; (i: number): number; }) => number
|
||||
>foo : (a: { (): number; (i: number): number; }) => number
|
||||
>function(a){return 5} : (a: { (): number; (i: number): number; }) => 5
|
||||
>function(a){return 5} : (a: { (): number; (i: number): number; }) => number
|
||||
>a : { (): number; (i: number): number; }
|
||||
>5 : 5
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(this: void, a: string) => 5' is not assignable to type '(a: { (): number; (i: number): number; }) => number'.
|
||||
tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(this: void, a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'.
|
||||
Types of parameters 'a' and 'a' are incompatible.
|
||||
Type '{ (): number; (i: number): number; }' is not assignable to type 'string'.
|
||||
|
||||
@@ -6,6 +6,6 @@ tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(this: voi
|
||||
==== tests/cases/compiler/contextualTyping24.ts (1 errors) ====
|
||||
var foo:(a:{():number; (i:number):number; })=>number; foo = function(this: void, a:string){return 5};
|
||||
~~~
|
||||
!!! error TS2322: Type '(this: void, a: string) => 5' is not assignable to type '(a: { (): number; (i: number): number; }) => number'.
|
||||
!!! error TS2322: Type '(this: void, a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'.
|
||||
!!! error TS2322: Types of parameters 'a' and 'a' are incompatible.
|
||||
!!! error TS2322: Type '{ (): number; (i: number): number; }' is not assignable to type 'string'.
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/compiler/contextualTyping39.ts(1,11): error TS2352: Type '() => "err"' cannot be converted to type '() => number'.
|
||||
Type '"err"' is not comparable to type 'number'.
|
||||
tests/cases/compiler/contextualTyping39.ts(1,11): error TS2352: Type '() => string' cannot be converted to type '() => number'.
|
||||
Type 'string' is not comparable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/contextualTyping39.ts (1 errors) ====
|
||||
var foo = <{ (): number; }> function() { return "err"; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2352: Type '() => "err"' cannot be converted to type '() => number'.
|
||||
!!! error TS2352: Type '"err"' is not comparable to type 'number'.
|
||||
!!! error TS2352: Type '() => string' cannot be converted to type '() => number'.
|
||||
!!! error TS2352: Type 'string' is not comparable to type 'number'.
|
||||
@@ -29,11 +29,11 @@ foo((y): (y2: number) => void => {
|
||||
foo((y: string) => {
|
||||
>foo((y: string) => { return y2 => { var z = y2.toFixed(); // Should be string return 0; };}) : any
|
||||
>foo : (x: (y: string) => (y2: number) => void) => any
|
||||
>(y: string) => { return y2 => { var z = y2.toFixed(); // Should be string return 0; };} : (y: string) => (y2: number) => 0
|
||||
>(y: string) => { return y2 => { var z = y2.toFixed(); // Should be string return 0; };} : (y: string) => (y2: number) => number
|
||||
>y : string
|
||||
|
||||
return y2 => {
|
||||
>y2 => { var z = y2.toFixed(); // Should be string return 0; } : (y2: number) => 0
|
||||
>y2 => { var z = y2.toFixed(); // Should be string return 0; } : (y2: number) => number
|
||||
>y2 : number
|
||||
|
||||
var z = y2.toFixed(); // Should be string
|
||||
|
||||
@@ -11,9 +11,9 @@ var v: { a: (_: string) => number } = { a: s => s.length } || { a: s => 1 };
|
||||
>s.length : number
|
||||
>s : string
|
||||
>length : number
|
||||
>{ a: s => 1 } : { a: (s: string) => 1; }
|
||||
>a : (s: string) => 1
|
||||
>s => 1 : (s: string) => 1
|
||||
>{ a: s => 1 } : { a: (s: string) => number; }
|
||||
>a : (s: string) => number
|
||||
>s => 1 : (s: string) => number
|
||||
>s : string
|
||||
>1 : 1
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ var v: { a: (_: string) => number } = { a: s => s.length } || { a: s => 1 };
|
||||
>s.length : number
|
||||
>s : string
|
||||
>length : number
|
||||
>{ a: s => 1 } : { a: (s: string) => 1; }
|
||||
>a : (s: string) => 1
|
||||
>s => 1 : (s: string) => 1
|
||||
>{ a: s => 1 } : { a: (s: string) => number; }
|
||||
>a : (s: string) => number
|
||||
>s => 1 : (s: string) => number
|
||||
>s : string
|
||||
>1 : 1
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ var anOtherFunction: (x: string) => number = F;
|
||||
var aLambda: typeof F = (x) => 2;
|
||||
>aLambda : (x: string) => number
|
||||
>F : (x: string) => number
|
||||
>(x) => 2 : (x: string) => 2
|
||||
>(x) => 2 : (x: string) => number
|
||||
>x : string
|
||||
>2 : 2
|
||||
|
||||
@@ -158,7 +158,7 @@ var aFunctionInModule: typeof M.F2 = (x) => 'this is a string';
|
||||
>M.F2 : (x: number) => string
|
||||
>M : typeof M
|
||||
>F2 : (x: number) => string
|
||||
>(x) => 'this is a string' : (x: number) => "this is a string"
|
||||
>(x) => 'this is a string' : (x: number) => string
|
||||
>x : number
|
||||
>'this is a string' : "this is a string"
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(47,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(48,5): error TS2322: Type '(x: string) => "a string"' is not assignable to type '(x: string) => number'.
|
||||
Type '"a string"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(48,5): error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(50,5): error TS2322: Type 'typeof N' is not assignable to type 'typeof M'.
|
||||
Types of property 'A' are incompatible.
|
||||
Type 'typeof N.A' is not assignable to type 'typeof M.A'.
|
||||
@@ -115,8 +115,8 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
var aLambda: typeof F = (x) => 'a string';
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '(x: string) => "a string"' is not assignable to type '(x: string) => number'.
|
||||
!!! error TS2322: Type '"a string"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
var aModule: typeof M = N;
|
||||
~~~~~~~
|
||||
|
||||
@@ -20,7 +20,7 @@ export default async(() => await(Promise.resolve(1)));
|
||||
>() => await(Promise.resolve(1)) : () => any
|
||||
>await(Promise.resolve(1)) : any
|
||||
>await : (...args: any[]) => any
|
||||
>Promise.resolve(1) : Promise<number>
|
||||
>Promise.resolve(1) : Promise<1>
|
||||
>Promise.resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
||||
|
||||
@@ -16,7 +16,7 @@ trans(({a}) => a);
|
||||
trans(([b,c]) => 'foo');
|
||||
>trans(([b,c]) => 'foo') : number
|
||||
>trans : <T>(f: (x: T) => string) => number
|
||||
>([b,c]) => 'foo' : ([b, c]: [any, any]) => "foo"
|
||||
>([b,c]) => 'foo' : ([b, c]: [any, any]) => string
|
||||
>b : any
|
||||
>c : any
|
||||
>'foo' : "foo"
|
||||
@@ -24,7 +24,7 @@ trans(([b,c]) => 'foo');
|
||||
trans(({d: [e,f]}) => 'foo');
|
||||
>trans(({d: [e,f]}) => 'foo') : number
|
||||
>trans : <T>(f: (x: T) => string) => number
|
||||
>({d: [e,f]}) => 'foo' : ({d: [e, f]}: { d: [any, any]; }) => "foo"
|
||||
>({d: [e,f]}) => 'foo' : ({d: [e, f]}: { d: [any, any]; }) => string
|
||||
>d : any
|
||||
>e : any
|
||||
>f : any
|
||||
@@ -33,7 +33,7 @@ trans(({d: [e,f]}) => 'foo');
|
||||
trans(([{g},{h}]) => 'foo');
|
||||
>trans(([{g},{h}]) => 'foo') : number
|
||||
>trans : <T>(f: (x: T) => string) => number
|
||||
>([{g},{h}]) => 'foo' : ([{g}, {h}]: [{ g: any; }, { h: any; }]) => "foo"
|
||||
>([{g},{h}]) => 'foo' : ([{g}, {h}]: [{ g: any; }, { h: any; }]) => string
|
||||
>g : any
|
||||
>h : any
|
||||
>'foo' : "foo"
|
||||
|
||||
@@ -136,7 +136,7 @@ for(var anOtherFunction: (x: string) => number = F;;){}
|
||||
for(var aLambda: typeof F = (x) => 2;;){}
|
||||
>aLambda : (x: string) => number
|
||||
>F : (x: string) => number
|
||||
>(x) => 2 : (x: string) => 2
|
||||
>(x) => 2 : (x: string) => number
|
||||
>x : string
|
||||
>2 : 2
|
||||
|
||||
@@ -159,7 +159,7 @@ for(var aFunctionInModule: typeof M.F2 = (x) => 'this is a string';;){}
|
||||
>M.F2 : (x: number) => string
|
||||
>M : typeof M
|
||||
>F2 : (x: number) => string
|
||||
>(x) => 'this is a string' : (x: number) => "this is a string"
|
||||
>(x) => 'this is a string' : (x: number) => string
|
||||
>x : number
|
||||
>'this is a string' : "this is a string"
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ var func = function (){return "ONE";};
|
||||
>"ONE" : "ONE"
|
||||
|
||||
func = function (){return "ONE";};
|
||||
>func = function (){return "ONE";} : () => "ONE"
|
||||
>func = function (){return "ONE";} : () => string
|
||||
>func : () => string
|
||||
>function (){return "ONE";} : () => "ONE"
|
||||
>function (){return "ONE";} : () => string
|
||||
>"ONE" : "ONE"
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ var a0: (n: number, s: string) => number = (num, str) => {
|
||||
>a0 : (n: number, s: string) => number
|
||||
>n : number
|
||||
>s : string
|
||||
>(num, str) => { num.toExponential(); return 0;} : (num: number, str: string) => 0
|
||||
>(num, str) => { num.toExponential(); return 0;} : (num: number, str: string) => number
|
||||
>num : number
|
||||
>str : string
|
||||
|
||||
@@ -41,7 +41,7 @@ var a1: (c: Class<Number>) => number = (a1) => {
|
||||
>c : Class<Number>
|
||||
>Class : Class<T>
|
||||
>Number : Number
|
||||
>(a1) => { a1.foo(); return 1;} : (a1: Class<Number>) => 1
|
||||
>(a1) => { a1.foo(); return 1;} : (a1: Class<Number>) => number
|
||||
>a1 : Class<Number>
|
||||
|
||||
a1.foo();
|
||||
@@ -90,9 +90,9 @@ b2 = (foo, bar) => { return foo + 1; }
|
||||
>1 : 1
|
||||
|
||||
b2 = (foo, bar) => { return "hello"; }
|
||||
>b2 = (foo, bar) => { return "hello"; } : (foo: number, bar: string) => "hello"
|
||||
>b2 = (foo, bar) => { return "hello"; } : (foo: number, bar: string) => string
|
||||
>b2 : ((n: number, s: string) => number) | ((n: number, s: string) => string)
|
||||
>(foo, bar) => { return "hello"; } : (foo: number, bar: string) => "hello"
|
||||
>(foo, bar) => { return "hello"; } : (foo: number, bar: string) => string
|
||||
>foo : number
|
||||
>bar : string
|
||||
>"hello" : "hello"
|
||||
@@ -114,7 +114,7 @@ var b4: (n: E) => string = (number = 1) => { return "hello"; };
|
||||
>b4 : (n: E) => string
|
||||
>n : E
|
||||
>E : E
|
||||
>(number = 1) => { return "hello"; } : (number?: E) => "hello"
|
||||
>(number = 1) => { return "hello"; } : (number?: E) => string
|
||||
>number : E
|
||||
>1 : 1
|
||||
>"hello" : "hello"
|
||||
@@ -122,7 +122,7 @@ var b4: (n: E) => string = (number = 1) => { return "hello"; };
|
||||
var b5: (n: {}) => string = (number = "string") => { return "hello"; };
|
||||
>b5 : (n: {}) => string
|
||||
>n : {}
|
||||
>(number = "string") => { return "hello"; } : (number?: {}) => "hello"
|
||||
>(number = "string") => { return "hello"; } : (number?: {}) => string
|
||||
>number : {}
|
||||
>"string" : "string"
|
||||
>"hello" : "hello"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/expressions/contextualTyping/functionExpressionContextualTyping2.ts(11,1): error TS2322: Type '(foo: number, bar: string) => true' is not assignable to type '((n: number, s: string) => number) | ((n: number, s: string) => string)'.
|
||||
Type '(foo: number, bar: string) => true' is not assignable to type '(n: number, s: string) => string'.
|
||||
Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/contextualTyping/functionExpressionContextualTyping2.ts(11,1): error TS2322: Type '(foo: number, bar: string) => boolean' is not assignable to type '((n: number, s: string) => number) | ((n: number, s: string) => string)'.
|
||||
Type '(foo: number, bar: string) => boolean' is not assignable to type '(n: number, s: string) => string'.
|
||||
Type 'boolean' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/contextualTyping/functionExpressionContextualTyping2.ts (1 errors) ====
|
||||
@@ -16,6 +16,6 @@ tests/cases/conformance/expressions/contextualTyping/functionExpressionContextua
|
||||
var a1: typeof a0 | ((n: number, s: string) => string);
|
||||
a1 = (foo, bar) => { return true; } // Error
|
||||
~~
|
||||
!!! error TS2322: Type '(foo: number, bar: string) => true' is not assignable to type '((n: number, s: string) => number) | ((n: number, s: string) => string)'.
|
||||
!!! error TS2322: Type '(foo: number, bar: string) => true' is not assignable to type '(n: number, s: string) => string'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type '(foo: number, bar: string) => boolean' is not assignable to type '((n: number, s: string) => number) | ((n: number, s: string) => string)'.
|
||||
!!! error TS2322: Type '(foo: number, bar: string) => boolean' is not assignable to type '(n: number, s: string) => string'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts(10,14): error TS2345: Argument of type '{ cb: <T>(x: T, y: T) => ""; }' is not assignable to parameter of type '{ cb: (t: {}) => string; }'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts(10,14): error TS2345: Argument of type '{ cb: <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: (t: {}) => string; }'.
|
||||
Types of property 'cb' are incompatible.
|
||||
Type '<T>(x: T, y: T) => ""' is not assignable to type '(t: {}) => string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts(11,14): error TS2345: Argument of type '{ cb: (x: string, y: number) => ""; }' is not assignable to parameter of type '{ cb: (t: string) => string; }'.
|
||||
Type '<T>(x: T, y: T) => string' is not assignable to type '(t: {}) => string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts(11,14): error TS2345: Argument of type '{ cb: (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: (t: string) => string; }'.
|
||||
Types of property 'cb' are incompatible.
|
||||
Type '(x: string, y: number) => ""' is not assignable to type '(t: string) => string'.
|
||||
Type '(x: string, y: number) => string' is not assignable to type '(t: string) => string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts (2 errors) ====
|
||||
@@ -18,14 +18,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun
|
||||
// more args not allowed
|
||||
var r2 = foo({ cb: <T>(x: T, y: T) => '' }); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ cb: <T>(x: T, y: T) => ""; }' is not assignable to parameter of type '{ cb: (t: {}) => string; }'.
|
||||
!!! error TS2345: Argument of type '{ cb: <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: (t: {}) => string; }'.
|
||||
!!! error TS2345: Types of property 'cb' are incompatible.
|
||||
!!! error TS2345: Type '<T>(x: T, y: T) => ""' is not assignable to type '(t: {}) => string'.
|
||||
!!! error TS2345: Type '<T>(x: T, y: T) => string' is not assignable to type '(t: {}) => string'.
|
||||
var r3 = foo({ cb: (x: string, y: number) => '' }); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ cb: (x: string, y: number) => ""; }' is not assignable to parameter of type '{ cb: (t: string) => string; }'.
|
||||
!!! error TS2345: Argument of type '{ cb: (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: (t: string) => string; }'.
|
||||
!!! error TS2345: Types of property 'cb' are incompatible.
|
||||
!!! error TS2345: Type '(x: string, y: number) => ""' is not assignable to type '(t: string) => string'.
|
||||
!!! error TS2345: Type '(x: string, y: number) => string' is not assignable to type '(t: string) => string'.
|
||||
|
||||
function foo2<T, U>(arg: { cb: (t: T, t2: T) => U }) {
|
||||
return arg.cb(null, null);
|
||||
|
||||
@@ -63,7 +63,7 @@ var r3 = utils.mapReduce(c, (x) => { return 1 }, (y) => { return new Date() });
|
||||
>utils : Utils
|
||||
>mapReduce : <T, U, V>(c: Collection<T>, mapper: (x: T) => U, reducer: (y: U) => V) => Collection<V>
|
||||
>c : Collection<string>
|
||||
>(x) => { return 1 } : (x: string) => 1
|
||||
>(x) => { return 1 } : (x: string) => number
|
||||
>x : string
|
||||
>1 : 1
|
||||
>(y) => { return new Date() } : (y: number) => Date
|
||||
@@ -78,7 +78,7 @@ var r4 = utils.mapReduce(c, (x: string) => { return 1 }, (y: number) => { return
|
||||
>utils : Utils
|
||||
>mapReduce : <T, U, V>(c: Collection<T>, mapper: (x: T) => U, reducer: (y: U) => V) => Collection<V>
|
||||
>c : Collection<string>
|
||||
>(x: string) => { return 1 } : (x: string) => 1
|
||||
>(x: string) => { return 1 } : (x: string) => number
|
||||
>x : string
|
||||
>1 : 1
|
||||
>(y: number) => { return new Date() } : (y: number) => Date
|
||||
|
||||
@@ -59,9 +59,9 @@ ls = "eager";
|
||||
>"eager" : "eager"
|
||||
|
||||
ls = () => "lazy";
|
||||
>ls = () => "lazy" : () => "lazy"
|
||||
>ls = () => "lazy" : () => string
|
||||
>ls : Lazy<string>
|
||||
>() => "lazy" : () => "lazy"
|
||||
>() => "lazy" : () => string
|
||||
>"lazy" : "lazy"
|
||||
|
||||
type Foo<T> = T | { x: Foo<T> };
|
||||
|
||||
@@ -23,7 +23,7 @@ tests/cases/compiler/incompatibleTypes.ts(49,7): error TS2345: Argument of type
|
||||
tests/cases/compiler/incompatibleTypes.ts(66,47): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'.
|
||||
Object literal may only specify known properties, and 'e' does not exist in type '{ a: { a: string; }; b: string; }'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(72,5): error TS2322: Type '5' is not assignable to type '() => string'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => 0' is not assignable to type '() => any'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => number' is not assignable to type '() => any'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/incompatibleTypes.ts (9 errors) ====
|
||||
@@ -135,5 +135,5 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) =>
|
||||
|
||||
var fp1: () =>any = a => 0;
|
||||
~~~
|
||||
!!! error TS2322: Type '(a: any) => 0' is not assignable to type '() => any'.
|
||||
!!! error TS2322: Type '(a: any) => number' is not assignable to type '() => any'.
|
||||
|
||||
@@ -33,6 +33,6 @@ foo(n => n.length, () => 'hi');
|
||||
>n.length : number
|
||||
>n : string
|
||||
>length : number
|
||||
>() => 'hi' : () => "hi"
|
||||
>() => 'hi' : () => string
|
||||
>'hi' : "hi"
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ interface Foo {
|
||||
var a: Foo = {
|
||||
>a : Foo
|
||||
>Foo : Foo
|
||||
>{ a: 1, b: '', c: true, d: {}, e: null , f: [1], g: {}, h: (x: number) => 1, i: <T>(x: T) => x, j: <Foo>null, k: new C(), l: f1, m: M, n: {}, o: E.A} : { a: number; b: string; c: true; d: {}; e: null; f: number[]; g: {}; h: (x: number) => 1; i: <T>(x: T) => T; j: Foo; k: C; l: () => void; m: typeof M; n: {}; o: E; }
|
||||
>{ a: 1, b: '', c: true, d: {}, e: null , f: [1], g: {}, h: (x: number) => 1, i: <T>(x: T) => x, j: <Foo>null, k: new C(), l: f1, m: M, n: {}, o: E.A} : { a: number; b: string; c: true; d: {}; e: null; f: number[]; g: {}; h: (x: number) => number; i: <T>(x: T) => T; j: Foo; k: C; l: () => void; m: typeof M; n: {}; o: E; }
|
||||
|
||||
a: 1,
|
||||
>a : number
|
||||
@@ -112,8 +112,8 @@ var a: Foo = {
|
||||
>{} : {}
|
||||
|
||||
h: (x: number) => 1,
|
||||
>h : (x: number) => 1
|
||||
>(x: number) => 1 : (x: number) => 1
|
||||
>h : (x: number) => number
|
||||
>(x: number) => 1 : (x: number) => number
|
||||
>x : number
|
||||
>1 : 1
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ var p2 = p.then(function (s) {
|
||||
>p.then : { <U>(success?: (value: string) => Windows.Foundation.IPromise<U>, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: string) => Windows.Foundation.IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; }
|
||||
>p : Windows.Foundation.IPromise<string>
|
||||
>then : { <U>(success?: (value: string) => Windows.Foundation.IPromise<U>, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: string) => Windows.Foundation.IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; }
|
||||
>function (s) { return 34;} : (s: string) => 34
|
||||
>function (s) { return 34;} : (s: string) => number
|
||||
>s : string
|
||||
|
||||
return 34;
|
||||
|
||||
@@ -114,7 +114,7 @@ p.then(function (x) { return "hello"; } ).then(function (x) { return x } ); // s
|
||||
>p.then : { <U>(success?: (value: number) => Windows.Foundation.IPromise<U>, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: number) => Windows.Foundation.IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; }
|
||||
>p : Windows.Foundation.IPromise<number>
|
||||
>then : { <U>(success?: (value: number) => Windows.Foundation.IPromise<U>, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: number) => Windows.Foundation.IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; }
|
||||
>function (x) { return "hello"; } : (x: number) => "hello"
|
||||
>function (x) { return "hello"; } : (x: number) => string
|
||||
>x : number
|
||||
>"hello" : "hello"
|
||||
>then : { <U>(success?: (value: string) => Windows.Foundation.IPromise<U>, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: string) => Windows.Foundation.IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>; }
|
||||
|
||||
@@ -215,7 +215,7 @@ let errorCallback = () => error("Error callback");
|
||||
test(() => "hello");
|
||||
>test(() => "hello") : string
|
||||
>test : (cb: () => string) => string
|
||||
>() => "hello" : () => "hello"
|
||||
>() => "hello" : () => string
|
||||
>"hello" : "hello"
|
||||
|
||||
test(() => fail());
|
||||
|
||||
@@ -14,8 +14,8 @@ async function test(isError: boolean = false) {
|
||||
}
|
||||
let x = await Promise.resolve("The test is passed without an error.");
|
||||
>x : string
|
||||
>await Promise.resolve("The test is passed without an error.") : string
|
||||
>Promise.resolve("The test is passed without an error.") : Promise<string>
|
||||
>await Promise.resolve("The test is passed without an error.") : "The test is passed without an error."
|
||||
>Promise.resolve("The test is passed without an error.") : Promise<"The test is passed without an error.">
|
||||
>Promise.resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
>"accProperty" : "accProperty"
|
||||
><PropertyDescriptor>({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } }) : PropertyDescriptor
|
||||
>PropertyDescriptor : PropertyDescriptor
|
||||
>({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } }) : { get: () => 11; set: (v: any) => void; }
|
||||
>{ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } } : { get: () => 11; set: (v: any) => void; }
|
||||
>({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } }) : { get: () => number; set: (v: any) => void; }
|
||||
>{ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } } : { get: () => number; set: (v: any) => void; }
|
||||
|
||||
get: function () {
|
||||
>get : () => 11
|
||||
>function () { eval("public = 1;"); return 11; } : () => 11
|
||||
>get : () => number
|
||||
>function () { eval("public = 1;"); return 11; } : () => number
|
||||
|
||||
eval("public = 1;");
|
||||
>eval("public = 1;") : any
|
||||
|
||||
@@ -22,9 +22,9 @@ defineMyProperty({}, "name", { get: function () { return 5; } });
|
||||
>defineMyProperty : (o: any, p: string, attributes: MyPropertyDescriptor) => any
|
||||
>{} : {}
|
||||
>"name" : "name"
|
||||
>{ get: function () { return 5; } } : { get: () => 5; }
|
||||
>get : () => 5
|
||||
>function () { return 5; } : () => 5
|
||||
>{ get: function () { return 5; } } : { get: () => number; }
|
||||
>get : () => number
|
||||
>function () { return 5; } : () => number
|
||||
>5 : 5
|
||||
|
||||
interface MyPropertyDescriptor2 {
|
||||
@@ -50,8 +50,8 @@ defineMyProperty2({}, "name", { get: function () { return 5; } });
|
||||
>defineMyProperty2 : (o: any, p: string, attributes: MyPropertyDescriptor2) => any
|
||||
>{} : {}
|
||||
>"name" : "name"
|
||||
>{ get: function () { return 5; } } : { get: () => 5; }
|
||||
>get : () => 5
|
||||
>function () { return 5; } : () => 5
|
||||
>{ get: function () { return 5; } } : { get: () => number; }
|
||||
>get : () => number
|
||||
>function () { return 5; } : () => number
|
||||
>5 : 5
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
var f: (x: 'hi') => number = (x: 'hi') => { return 1; };
|
||||
>f : (x: "hi") => number
|
||||
>x : "hi"
|
||||
>(x: 'hi') => { return 1; } : (x: "hi") => 1
|
||||
>(x: 'hi') => { return 1; } : (x: "hi") => number
|
||||
>x : "hi"
|
||||
>1 : 1
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(12,18): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(18,9): error TS2345: Argument of type '(x: "bye") => 1' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(18,9): error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '"hi"' is not assignable to type '"bye"'.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(21,9): error TS2345: Argument of type '(x: number) => 1' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(21,9): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '"hi"' is not assignable to type 'number'.
|
||||
|
||||
@@ -29,13 +29,13 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(21,9): error TS2345:
|
||||
c.x1(1, (x: 'hi') => { return 1; } );
|
||||
c.x1(1, (x: 'bye') => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: "bye") => 1' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type '"hi"' is not assignable to type '"bye"'.
|
||||
c.x1(1, (x) => { return 1; } );
|
||||
|
||||
c.x1(1, (x: number) => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number) => 1' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type '"hi"' is not assignable to type 'number'.
|
||||
@@ -50,7 +50,7 @@ function x2(a: number, cb: (x: any) => number) {
|
||||
var cb: (number) => number = (x: number) => 1;
|
||||
>cb : (number: any) => number
|
||||
>number : any
|
||||
>(x: number) => 1 : (x: number) => 1
|
||||
>(x: number) => 1 : (x: number) => number
|
||||
>x : number
|
||||
>1 : 1
|
||||
|
||||
@@ -64,7 +64,7 @@ x2(1, (x: 'hi') => 1); // error
|
||||
>x2(1, (x: 'hi') => 1) : any
|
||||
>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; }
|
||||
>1 : 1
|
||||
>(x: 'hi') => 1 : (x: "hi") => 1
|
||||
>(x: 'hi') => 1 : (x: "hi") => number
|
||||
>x : "hi"
|
||||
>1 : 1
|
||||
|
||||
@@ -72,7 +72,7 @@ x2(1, (x: string) => 1);
|
||||
>x2(1, (x: string) => 1) : any
|
||||
>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; }
|
||||
>1 : 1
|
||||
>(x: string) => 1 : (x: string) => 1
|
||||
>(x: string) => 1 : (x: string) => number
|
||||
>x : string
|
||||
>1 : 1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(18,9): error TS2345: Argument of type '(x: "bye") => 1' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(18,9): error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '"hi"' is not assignable to type '"bye"'.
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(20,9): error TS2345: Argument of type '(x: number) => 1' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(20,9): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '"hi"' is not assignable to type 'number'.
|
||||
|
||||
@@ -26,12 +26,12 @@ tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(20,9): error TS23
|
||||
c.x1(1, (x: 'hi') => { return 1; } );
|
||||
c.x1(1, (x: 'bye') => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: "bye") => 1' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Argument of type '(x: "bye") => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type '"hi"' is not assignable to type '"bye"'.
|
||||
c.x1(1, (x: string) => { return 1; } );
|
||||
c.x1(1, (x: number) => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number) => 1' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type '"hi"' is not assignable to type 'number'.
|
||||
@@ -17,13 +17,13 @@ function x2(callback: (x: any) => number) { }
|
||||
x2(() => 1);
|
||||
>x2(() => 1) : any
|
||||
>x2 : { (callback: (x?: number) => number): any; (callback: (x: string) => number): any; }
|
||||
>() => 1 : () => 1
|
||||
>() => 1 : () => number
|
||||
>1 : 1
|
||||
|
||||
x2((x) => 1 );
|
||||
>x2((x) => 1 ) : any
|
||||
>x2 : { (callback: (x?: number) => number): any; (callback: (x: string) => number): any; }
|
||||
>(x) => 1 : (x: number) => 1
|
||||
>(x) => 1 : (x: number) => number
|
||||
>x : number
|
||||
>1 : 1
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class Chain<T> {
|
||||
>x : T
|
||||
>result : S
|
||||
>then : <S>(cb: (x: S) => S) => Chain<S>
|
||||
>x => "abc" : (x: S) => "abc"
|
||||
>x => "abc" : (x: S) => string
|
||||
>x : S
|
||||
>"abc" : "abc"
|
||||
>then : <S>(cb: (x: string) => S) => Chain<S>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/promiseChaining1.ts(7,50): error TS2345: Argument of type '(x: S) => "abc"' is not assignable to parameter of type '(x: S) => Function'.
|
||||
Type '"abc"' is not assignable to type 'Function'.
|
||||
tests/cases/compiler/promiseChaining1.ts(7,50): error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
|
||||
Type 'string' is not assignable to type 'Function'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promiseChaining1.ts (1 errors) ====
|
||||
@@ -11,8 +11,8 @@ tests/cases/compiler/promiseChaining1.ts(7,50): error TS2345: Argument of type '
|
||||
// should get a fresh type parameter which each then call
|
||||
var z = this.then(x => result)/*S*/.then(x => "abc")/*Function*/.then(x => x.length)/*number*/; // Should error on "abc" because it is not a Function
|
||||
~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: S) => "abc"' is not assignable to parameter of type '(x: S) => Function'.
|
||||
!!! error TS2345: Type '"abc"' is not assignable to type 'Function'.
|
||||
!!! error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'Function'.
|
||||
return new Chain2(result);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/promiseChaining2.ts(7,45): error TS2345: Argument of type '(x: S) => "abc"' is not assignable to parameter of type '(x: S) => Function'.
|
||||
Type '"abc"' is not assignable to type 'Function'.
|
||||
tests/cases/compiler/promiseChaining2.ts(7,45): error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
|
||||
Type 'string' is not assignable to type 'Function'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promiseChaining2.ts (1 errors) ====
|
||||
@@ -11,8 +11,8 @@ tests/cases/compiler/promiseChaining2.ts(7,45): error TS2345: Argument of type '
|
||||
// should get a fresh type parameter which each then call
|
||||
var z = this.then(x => result).then(x => "abc").then(x => x.length);
|
||||
~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: S) => "abc"' is not assignable to parameter of type '(x: S) => Function'.
|
||||
!!! error TS2345: Type '"abc"' is not assignable to type 'Function'.
|
||||
!!! error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'Function'.
|
||||
return new Chain2(result);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ const b = p.then(b => 1);
|
||||
>p.then : { <TResult1, TResult2>(onfulfilled: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>): Promise<TResult>; (): Promise<boolean>; }
|
||||
>p : Promise<boolean>
|
||||
>then : { <TResult1, TResult2>(onfulfilled: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>): Promise<TResult>; (): Promise<boolean>; }
|
||||
>b => 1 : (b: boolean) => 1
|
||||
>b => 1 : (b: boolean) => number
|
||||
>b : boolean
|
||||
>1 : 1
|
||||
|
||||
@@ -26,10 +26,10 @@ const c = p.then(b => 1, e => 'error');
|
||||
>p.then : { <TResult1, TResult2>(onfulfilled: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>): Promise<TResult>; (): Promise<boolean>; }
|
||||
>p : Promise<boolean>
|
||||
>then : { <TResult1, TResult2>(onfulfilled: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>): Promise<TResult>; (): Promise<boolean>; }
|
||||
>b => 1 : (b: boolean) => 1
|
||||
>b => 1 : (b: boolean) => number
|
||||
>b : boolean
|
||||
>1 : 1
|
||||
>e => 'error' : (e: any) => "error"
|
||||
>e => 'error' : (e: any) => string
|
||||
>e : any
|
||||
>'error' : "error"
|
||||
|
||||
@@ -39,7 +39,7 @@ const d = p.then(b => 1, e => { });
|
||||
>p.then : { <TResult1, TResult2>(onfulfilled: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>): Promise<TResult>; (): Promise<boolean>; }
|
||||
>p : Promise<boolean>
|
||||
>then : { <TResult1, TResult2>(onfulfilled: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>): Promise<TResult>; (): Promise<boolean>; }
|
||||
>b => 1 : (b: boolean) => 1
|
||||
>b => 1 : (b: boolean) => number
|
||||
>b : boolean
|
||||
>1 : 1
|
||||
>e => { } : (e: any) => void
|
||||
@@ -51,7 +51,7 @@ const e = p.then(b => 1, e => { throw Error(); });
|
||||
>p.then : { <TResult1, TResult2>(onfulfilled: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>): Promise<TResult>; (): Promise<boolean>; }
|
||||
>p : Promise<boolean>
|
||||
>then : { <TResult1, TResult2>(onfulfilled: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>): Promise<TResult>; (): Promise<boolean>; }
|
||||
>b => 1 : (b: boolean) => 1
|
||||
>b => 1 : (b: boolean) => number
|
||||
>b : boolean
|
||||
>1 : 1
|
||||
>e => { throw Error(); } : (e: any) => never
|
||||
@@ -65,7 +65,7 @@ const f = p.then(b => 1, e => Promise.reject(Error()));
|
||||
>p.then : { <TResult1, TResult2>(onfulfilled: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>): Promise<TResult>; (): Promise<boolean>; }
|
||||
>p : Promise<boolean>
|
||||
>then : { <TResult1, TResult2>(onfulfilled: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled: (value: boolean) => TResult | PromiseLike<TResult>): Promise<TResult>; (): Promise<boolean>; }
|
||||
>b => 1 : (b: boolean) => 1
|
||||
>b => 1 : (b: boolean) => number
|
||||
>b : boolean
|
||||
>1 : 1
|
||||
>e => Promise.reject(Error()) : (e: any) => Promise<never>
|
||||
@@ -83,7 +83,7 @@ const g = p.catch(e => 'error');
|
||||
>p.catch : { <TResult>(onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<boolean | TResult>; (onrejected: (reason: any) => boolean | PromiseLike<boolean>): Promise<boolean>; }
|
||||
>p : Promise<boolean>
|
||||
>catch : { <TResult>(onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<boolean | TResult>; (onrejected: (reason: any) => boolean | PromiseLike<boolean>): Promise<boolean>; }
|
||||
>e => 'error' : (e: any) => "error"
|
||||
>e => 'error' : (e: any) => string
|
||||
>e : any
|
||||
>'error' : "error"
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ foo.then((x) => {
|
||||
>foo.then : <TResult>(successCallback: (promiseValue: number) => TResult, errorCallback?: (reason: any) => TResult) => IPromise<TResult>
|
||||
>foo : IPromise<number>
|
||||
>then : <TResult>(successCallback: (promiseValue: number) => TResult, errorCallback?: (reason: any) => TResult) => IPromise<TResult>
|
||||
>(x) => { // x is inferred to be a number return "asdf";} : (x: number) => "asdf"
|
||||
>(x) => { // x is inferred to be a number return "asdf";} : (x: number) => string
|
||||
>x : number
|
||||
|
||||
// x is inferred to be a number
|
||||
@@ -37,7 +37,7 @@ foo.then((x) => {
|
||||
|
||||
}).then((x) => {
|
||||
>then : <TResult>(successCallback: (promiseValue: string) => TResult, errorCallback?: (reason: any) => TResult) => IPromise<TResult>
|
||||
>(x) => { // x is inferred to be string x.length; return 123;} : (x: string) => 123
|
||||
>(x) => { // x is inferred to be string x.length; return 123;} : (x: string) => number
|
||||
>x : string
|
||||
|
||||
// x is inferred to be string
|
||||
|
||||
@@ -16,7 +16,7 @@ module CallSignature {
|
||||
>r : (x: number) => void
|
||||
>foo1((x: number) => 1) : (x: number) => void
|
||||
>foo1 : { (cb: (x: number) => void): (x: number) => void; (cb: any): any; }
|
||||
>(x: number) => 1 : (x: number) => 1
|
||||
>(x: number) => 1 : (x: number) => number
|
||||
>x : number
|
||||
>1 : 1
|
||||
|
||||
@@ -24,7 +24,7 @@ module CallSignature {
|
||||
>r2 : (x: number) => void
|
||||
>foo1(<T>(x: T) => '') : (x: number) => void
|
||||
>foo1 : { (cb: (x: number) => void): (x: number) => void; (cb: any): any; }
|
||||
><T>(x: T) => '' : <T>(x: T) => ""
|
||||
><T>(x: T) => '' : <T>(x: T) => string
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
@@ -45,7 +45,7 @@ module CallSignature {
|
||||
>r3 : (x: number, y: number) => void
|
||||
>foo2((x: number, y: number) => 1) : (x: number, y: number) => void
|
||||
>foo2 : { (cb: (x: number, y: number) => void): (x: number, y: number) => void; (cb: any): any; }
|
||||
>(x: number, y: number) => 1 : (x: number, y: number) => 1
|
||||
>(x: number, y: number) => 1 : (x: number, y: number) => number
|
||||
>x : number
|
||||
>y : number
|
||||
>1 : 1
|
||||
@@ -54,7 +54,7 @@ module CallSignature {
|
||||
>r4 : (x: number, y: number) => void
|
||||
>foo2(<T>(x: T) => '') : (x: number, y: number) => void
|
||||
>foo2 : { (cb: (x: number, y: number) => void): (x: number, y: number) => void; (cb: any): any; }
|
||||
><T>(x: T) => '' : <T>(x: T) => ""
|
||||
><T>(x: T) => '' : <T>(x: T) => string
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesA.ts(2,15): error TS2345: Argument of type '(x: number) => ""' is not assignable to parameter of type '(x: number) => number'.
|
||||
Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesA.ts(2,15): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesA.ts (1 errors) ====
|
||||
declare function foo3(cb: (x: number) => number): typeof cb;
|
||||
var r5 = foo3((x: number) => ''); // error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: number) => ""' is not assignable to parameter of type '(x: number) => number'.
|
||||
!!! error TS2345: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => number'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
||||
@@ -4,15 +4,15 @@ var z: { x: number; y: (w:string)=>number;} = {
|
||||
>x : number
|
||||
>y : (w: string) => number
|
||||
>w : string
|
||||
>{ x: 12, y: function(w) { return 0; }} : { x: number; y: (w: string) => 0; }
|
||||
>{ x: 12, y: function(w) { return 0; }} : { x: number; y: (w: string) => number; }
|
||||
|
||||
x: 12,
|
||||
>x : number
|
||||
>12 : 12
|
||||
|
||||
y: function(w) {
|
||||
>y : (w: string) => 0
|
||||
>function(w) { return 0; } : (w: string) => 0
|
||||
>y : (w: string) => number
|
||||
>function(w) { return 0; } : (w: string) => number
|
||||
>w : string
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -132,7 +132,7 @@ function implicitThis(n: number): number {
|
||||
let impl: I = {
|
||||
>impl : I
|
||||
>I : I
|
||||
>{ a: 12, explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) explicitVoid1() { return 12; }, explicitStructural() { return this.a; }, explicitInterface() { return this.a; }, explicitThis() { return this.a; },} : { a: number; explicitVoid2: () => any; explicitVoid1(this: void): 12; explicitStructural(this: { a: number; }): number; explicitInterface(this: I): number; explicitThis(this: I): number; }
|
||||
>{ a: 12, explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) explicitVoid1() { return 12; }, explicitStructural() { return this.a; }, explicitInterface() { return this.a; }, explicitThis() { return this.a; },} : { a: number; explicitVoid2: () => any; explicitVoid1(this: void): number; explicitStructural(this: { a: number; }): number; explicitInterface(this: I): number; explicitThis(this: I): number; }
|
||||
|
||||
a: 12,
|
||||
>a : number
|
||||
@@ -146,7 +146,7 @@ let impl: I = {
|
||||
>a : any
|
||||
|
||||
explicitVoid1() { return 12; },
|
||||
>explicitVoid1 : (this: void) => 12
|
||||
>explicitVoid1 : (this: void) => number
|
||||
>12 : 12
|
||||
|
||||
explicitStructural() {
|
||||
@@ -178,19 +178,19 @@ let impl: I = {
|
||||
},
|
||||
}
|
||||
impl.explicitVoid1 = function () { return 12; };
|
||||
>impl.explicitVoid1 = function () { return 12; } : (this: void) => 12
|
||||
>impl.explicitVoid1 = function () { return 12; } : (this: void) => number
|
||||
>impl.explicitVoid1 : (this: void) => number
|
||||
>impl : I
|
||||
>explicitVoid1 : (this: void) => number
|
||||
>function () { return 12; } : (this: void) => 12
|
||||
>function () { return 12; } : (this: void) => number
|
||||
>12 : 12
|
||||
|
||||
impl.explicitVoid2 = () => 12;
|
||||
>impl.explicitVoid2 = () => 12 : () => 12
|
||||
>impl.explicitVoid2 = () => 12 : () => number
|
||||
>impl.explicitVoid2 : (this: void) => number
|
||||
>impl : I
|
||||
>explicitVoid2 : (this: void) => number
|
||||
>() => 12 : () => 12
|
||||
>() => 12 : () => number
|
||||
>12 : 12
|
||||
|
||||
impl.explicitStructural = function() { return this.a; };
|
||||
@@ -214,19 +214,19 @@ impl.explicitInterface = function() { return this.a; };
|
||||
>a : number
|
||||
|
||||
impl.explicitStructural = () => 12;
|
||||
>impl.explicitStructural = () => 12 : () => 12
|
||||
>impl.explicitStructural = () => 12 : () => number
|
||||
>impl.explicitStructural : (this: { a: number; }) => number
|
||||
>impl : I
|
||||
>explicitStructural : (this: { a: number; }) => number
|
||||
>() => 12 : () => 12
|
||||
>() => 12 : () => number
|
||||
>12 : 12
|
||||
|
||||
impl.explicitInterface = () => 12;
|
||||
>impl.explicitInterface = () => 12 : () => 12
|
||||
>impl.explicitInterface = () => 12 : () => number
|
||||
>impl.explicitInterface : (this: I) => number
|
||||
>impl : I
|
||||
>explicitInterface : (this: I) => number
|
||||
>() => 12 : () => 12
|
||||
>() => 12 : () => number
|
||||
>12 : 12
|
||||
|
||||
impl.explicitThis = function () { return this.a; };
|
||||
|
||||
@@ -138,7 +138,7 @@ extend2({
|
||||
simple({
|
||||
>simple({ foo(n) { return n.length + this.bar(); }, bar() { return 14; }}) : void
|
||||
>simple : (arg: SimpleInterface) => void
|
||||
>{ foo(n) { return n.length + this.bar(); }, bar() { return 14; }} : { foo(n: string): any; bar(): 14; }
|
||||
>{ foo(n) { return n.length + this.bar(); }, bar() { return 14; }} : { foo(n: string): any; bar(): number; }
|
||||
|
||||
foo(n) {
|
||||
>foo : (n: string) => any
|
||||
@@ -156,7 +156,7 @@ simple({
|
||||
|
||||
},
|
||||
bar() {
|
||||
>bar : () => 14
|
||||
>bar : () => number
|
||||
|
||||
return 14;
|
||||
>14 : 14
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(25,35): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(51,19): error TS2304: Cannot find name 'Window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(61,39): error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(61,39): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(71,39): error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(71,39): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(81,45): error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'.
|
||||
@@ -88,7 +88,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct
|
||||
new someGenerics4<string, number>('', () => 3);
|
||||
new someGenerics4<string, number>('', (x: string) => ''); // Error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
new someGenerics4<string, number>(null, null);
|
||||
@@ -102,7 +102,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct
|
||||
new someGenerics5<number, string>('', () => 3);
|
||||
new someGenerics5<number, string>('', (x: string) => ''); // Error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
new someGenerics5<string, number>(null, null);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(3,31): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(7,35): error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(7,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(11,35): error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(11,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(15,41): error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'.
|
||||
@@ -21,7 +21,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts
|
||||
function someGenerics4<T, U>(n: T, f: (x: U) => void) { }
|
||||
someGenerics4<string, number>('', (x: string) => ''); // Error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@@ -29,7 +29,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts
|
||||
function someGenerics5<U, T>(n: T, f: (x: U) => void) { }
|
||||
someGenerics5<number, string>('', (x: string) => ''); // Error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(17,23): error TS2344: Type '{}' does not satisfy the constraint 'number'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(32,34): error TS2304: Cannot find name 'Window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(34,15): error TS2304: Cannot find name 'Window'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(41,35): error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(41,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(48,35): error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(48,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(49,15): error TS2344: Type 'string' does not satisfy the constraint 'number'.
|
||||
@@ -79,7 +79,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
|
||||
someGenerics4<string, number>('', () => 3);
|
||||
someGenerics4<string, number>('', (x: string) => ''); // Error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
someGenerics4<string, number>(null, null);
|
||||
@@ -90,7 +90,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
|
||||
someGenerics5<number, string>('', () => 3);
|
||||
someGenerics5<number, string>('', (x: string) => ''); // Error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: string) => ""' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
someGenerics5<string, number>(null, null); // Error
|
||||
|
||||
@@ -11,7 +11,7 @@ declare function f<T>(p: (t: T) => T): T;
|
||||
f(n => 3);
|
||||
>f(n => 3) : {}
|
||||
>f : <T>(p: (t: T) => T) => T
|
||||
>n => 3 : (n: {}) => 3
|
||||
>n => 3 : (n: {}) => number
|
||||
>n : {}
|
||||
>3 : 3
|
||||
|
||||
|
||||
@@ -71,10 +71,10 @@ var result = destructure(value, text => 'string', y => 'other one'); // text: st
|
||||
>destructure(value, text => 'string', y => 'other one') : string
|
||||
>destructure : <a, r>(something: Y | a, haveValue: (value: a) => r, haveY: (value: Y) => r) => r
|
||||
>value : string | Y
|
||||
>text => 'string' : (text: string) => "string"
|
||||
>text => 'string' : (text: string) => string
|
||||
>text : string
|
||||
>'string' : "string"
|
||||
>y => 'other one' : (y: Y) => "other one"
|
||||
>y => 'other one' : (y: Y) => string
|
||||
>y : Y
|
||||
>'other one' : "other one"
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ var c1: number;
|
||||
|
||||
var c1 = h(5);
|
||||
>c1 : number
|
||||
>h(5) : number
|
||||
>h(5) : 5
|
||||
>h : <T>(x: string | boolean | T) => T
|
||||
>5 : 5
|
||||
|
||||
@@ -117,7 +117,7 @@ var c2: string;
|
||||
|
||||
var c2 = h("abc");
|
||||
>c2 : string
|
||||
>h("abc") : string
|
||||
>h("abc") : "abc"
|
||||
>h : <T>(x: string | boolean | T) => T
|
||||
>"abc" : "abc"
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ var fv = function(): void {}
|
||||
>function(): void {} : () => void
|
||||
|
||||
fv = function() { return 0; } // should work
|
||||
>fv = function() { return 0; } : () => 0
|
||||
>fv = function() { return 0; } : () => number
|
||||
>fv : () => void
|
||||
>function() { return 0; } : () => 0
|
||||
>function() { return 0; } : () => number
|
||||
>0 : 0
|
||||
|
||||
function execAny(callback:(val:any)=>any) { return callback(0) }
|
||||
@@ -43,7 +43,7 @@ function execVoid(callback:(val:any)=>void) { callback(0); }
|
||||
execVoid(function () {return 0;}); // should work
|
||||
>execVoid(function () {return 0;}) : void
|
||||
>execVoid : (callback: (val: any) => void) => void
|
||||
>function () {return 0;} : () => 0
|
||||
>function () {return 0;} : () => number
|
||||
>0 : 0
|
||||
|
||||
var fra: (v:any)=>any = function() { return function () {}; } // should work
|
||||
|
||||
Reference in New Issue
Block a user