Skip to content

This parameters in lib #9688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
743 changes: 373 additions & 370 deletions src/lib/es5.d.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/baselines/reference/2dArrays.types
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class Board {

return this.ships.every(function (val) { return val.isSunk; });
>this.ships.every(function (val) { return val.isSunk; }) : boolean
>this.ships.every : (callbackfn: (value: Ship, index: number, array: Ship[]) => boolean, thisArg?: any) => boolean
>this.ships.every : (this: Ship[], callbackfn: (value: Ship, index: number, array: Ship[]) => boolean, thisArg?: any) => boolean
>this.ships : Ship[]
>this : this
>ships : Ship[]
>every : (callbackfn: (value: Ship, index: number, array: Ship[]) => boolean, thisArg?: any) => boolean
>every : (this: Ship[], callbackfn: (value: Ship, index: number, array: Ship[]) => boolean, thisArg?: any) => boolean
>function (val) { return val.isSunk; } : (val: Ship) => boolean
>val : Ship
>val.isSunk : boolean
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5SymbolType1.types
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var s: symbol;

s.toString();
>s.toString() : string
>s.toString : () => string
>s.toString : (this: Object) => string
>s : symbol
>toString : () => string
>toString : (this: Object) => string

20 changes: 10 additions & 10 deletions tests/baselines/reference/anyInferenceAnonymousFunctions.types
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ var paired: any[];

paired.reduce(function (a1, a2) {
>paired.reduce(function (a1, a2) { return a1.concat({});} , []) : any
>paired.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>paired.reduce : { (this: any[], callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(this: any[], callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>paired : any[]
>reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>reduce : { (this: any[], callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(this: any[], callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>function (a1, a2) { return a1.concat({});} : (a1: any, a2: any) => any
>a1 : any
>a2 : any
Expand All @@ -23,9 +23,9 @@ paired.reduce(function (a1, a2) {

paired.reduce((b1, b2) => {
>paired.reduce((b1, b2) => { return b1.concat({});} , []) : any
>paired.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>paired.reduce : { (this: any[], callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(this: any[], callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>paired : any[]
>reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>reduce : { (this: any[], callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(this: any[], callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>(b1, b2) => { return b1.concat({});} : (b1: any, b2: any) => any
>b1 : any
>b2 : any
Expand All @@ -42,9 +42,9 @@ paired.reduce((b1, b2) => {

paired.reduce((b3, b4) => b3.concat({}), []);
>paired.reduce((b3, b4) => b3.concat({}), []) : any
>paired.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>paired.reduce : { (this: any[], callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(this: any[], callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>paired : any[]
>reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>reduce : { (this: any[], callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(this: any[], callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>(b3, b4) => b3.concat({}) : (b3: any, b4: any) => any
>b3 : any
>b4 : any
Expand All @@ -57,9 +57,9 @@ paired.reduce((b3, b4) => b3.concat({}), []);

paired.map((c1) => c1.count);
>paired.map((c1) => c1.count) : any[]
>paired.map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>paired.map : <U>(this: any[], callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>paired : any[]
>map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>map : <U>(this: any[], callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>(c1) => c1.count : (c1: any) => any
>c1 : any
>c1.count : any
Expand All @@ -68,9 +68,9 @@ paired.map((c1) => c1.count);

paired.map(function (c2) { return c2.count; });
>paired.map(function (c2) { return c2.count; }) : any[]
>paired.map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>paired.map : <U>(this: any[], callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>paired : any[]
>map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>map : <U>(this: any[], callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>function (c2) { return c2.count; } : (c2: any) => any
>c2 : any
>c2.count : any
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/argumentsObjectIterator01_ES6.types
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe

result.push(arg + arg);
>result.push(arg + arg) : number
>result.push : (...items: any[]) => number
>result.push : (this: any[], ...items: any[]) => number
>result : any[]
>push : (...items: any[]) => number
>push : (this: any[], ...items: any[]) => number
>arg + arg : any
>arg : any
>arg : any
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/argumentsObjectIterator02_ES6.types
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe

result.push(arg + arg);
>result.push(arg + arg) : number
>result.push : (...items: any[]) => number
>result.push : (this: any[], ...items: any[]) => number
>result : any[]
>push : (...items: any[]) => number
>push : (this: any[], ...items: any[]) => number
>arg + arg : any
>arg : any
>arg : any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(24,5): error
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(25,5): error TS2322: Type '[string, number]' is not assignable to type '[string]'.
Types of property 'pop' are incompatible.
Type '() => string | number' is not assignable to type '() => string'.
Type '(this: [string, number]) => string | number' is not assignable to type '(this: [string]) => string'.
Type 'string | number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(26,5): error TS2322: Type 'StrNum' is not assignable to type '[string]'.
Types of property 'pop' are incompatible.
Type '() => string | number' is not assignable to type '() => string'.
Type '(this: StrNum) => string | number' is not assignable to type '(this: [string]) => string'.
Type 'string | number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(27,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string]'.
Expand Down Expand Up @@ -118,14 +118,14 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(30,5): error
~~
!!! error TS2322: Type '[string, number]' is not assignable to type '[string]'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => string | number' is not assignable to type '() => string'.
!!! error TS2322: Type '(this: [string, number]) => string | number' is not assignable to type '(this: [string]) => string'.
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
var m2: [string] = y;
~~
!!! error TS2322: Type 'StrNum' is not assignable to type '[string]'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => string | number' is not assignable to type '() => string'.
!!! error TS2322: Type '(this: StrNum) => string | number' is not assignable to type '(this: [string]) => string'.
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
var m3: [string] = z;
Expand Down
12 changes: 6 additions & 6 deletions tests/baselines/reference/arrayConcat2.types
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ var a: string[] = [];

a.concat("hello", 'world');
>a.concat("hello", 'world') : string[]
>a.concat : { (...items: string[][]): string[]; (...items: (string | string[])[]): string[]; }
>a.concat : { (this: string[], ...items: string[][]): string[]; (this: string[], ...items: (string | string[])[]): string[]; }
>a : string[]
>concat : { (...items: string[][]): string[]; (...items: (string | string[])[]): string[]; }
>concat : { (this: string[], ...items: string[][]): string[]; (this: string[], ...items: (string | string[])[]): string[]; }
>"hello" : "hello"
>'world' : "world"

a.concat('Hello');
>a.concat('Hello') : string[]
>a.concat : { (...items: string[][]): string[]; (...items: (string | string[])[]): string[]; }
>a.concat : { (this: string[], ...items: string[][]): string[]; (this: string[], ...items: (string | string[])[]): string[]; }
>a : string[]
>concat : { (...items: string[][]): string[]; (...items: (string | string[])[]): string[]; }
>concat : { (this: string[], ...items: string[][]): string[]; (this: string[], ...items: (string | string[])[]): string[]; }
>'Hello' : "Hello"

var b = new Array<string>();
Expand All @@ -25,8 +25,8 @@ var b = new Array<string>();

b.concat('hello');
>b.concat('hello') : string[]
>b.concat : { (...items: string[][]): string[]; (...items: (string | string[])[]): string[]; }
>b.concat : { (this: string[], ...items: string[][]): string[]; (this: string[], ...items: (string | string[])[]): string[]; }
>b : string[]
>concat : { (...items: string[][]): string[]; (...items: (string | string[])[]): string[]; }
>concat : { (this: string[], ...items: string[][]): string[]; (this: string[], ...items: (string | string[])[]): string[]; }
>'hello' : "hello"

8 changes: 4 additions & 4 deletions tests/baselines/reference/arrayConcatMap.types
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
var x = [].concat([{ a: 1 }], [{ a: 2 }])
>x : any[]
>[].concat([{ a: 1 }], [{ a: 2 }]) .map(b => b.a) : any[]
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : <U>(this: any[], callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>[].concat([{ a: 1 }], [{ a: 2 }]) : any[]
>[].concat : { (...items: any[][]): any[]; (...items: any[]): any[]; }
>[].concat : { (this: any[], ...items: any[][]): any[]; (this: any[], ...items: any[]): any[]; }
>[] : undefined[]
>concat : { (...items: any[][]): any[]; (...items: any[]): any[]; }
>concat : { (this: any[], ...items: any[][]): any[]; (this: any[], ...items: any[]): any[]; }
>[{ a: 1 }] : { a: number; }[]
>{ a: 1 } : { a: number; }
>a : number
Expand All @@ -17,7 +17,7 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }])
>2 : 2

.map(b => b.a);
>map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>map : <U>(this: any[], callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
>b => b.a : (b: any) => any
>b : any
>b.a : any
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/arrayFilter.types
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ var foo = [

foo.filter(x => x.name); //should accepted all possible types not only boolean!
>foo.filter(x => x.name) : { name: string; }[]
>foo.filter : (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg?: any) => { name: string; }[]
>foo.filter : (this: { name: string; }[], callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg?: any) => { name: string; }[]
>foo : { name: string; }[]
>filter : (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg?: any) => { name: string; }[]
>filter : (this: { name: string; }[], callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg?: any) => { name: string; }[]
>x => x.name : (x: { name: string; }) => string
>x : { name: string; }
>x.name : string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionContextualTyping.ts(8,5): error TS2322: Type '[number, number, number, string]' is not assignable to type '[number, number, number]'.
Types of property 'pop' are incompatible.
Type '() => string | number' is not assignable to type '() => number'.
Type '(this: [number, number, number, string]) => string | number' is not assignable to type '(this: [number, number, number]) => number'.
Type 'string | number' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionContextualTyping.ts(14,5): error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'.
Expand All @@ -19,7 +19,7 @@ tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionConte
~~~~
!!! error TS2322: Type '[number, number, number, string]' is not assignable to type '[number, number, number]'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => string | number' is not assignable to type '() => number'.
!!! error TS2322: Type '(this: [number, number, number, string]) => string | number' is not assignable to type '(this: [number, number, number]) => number'.
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.

Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/arrayLiterals3.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,5): error
Type '"string"' is not assignable to type 'boolean'.
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'.
Types of property 'pop' are incompatible.
Type '() => string | number | boolean' is not assignable to type '() => number'.
Type '(this: [number, number, string, boolean]) => string | number | boolean' is not assignable to type '(this: [number, number]) => number'.
Type 'string | number | boolean' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(32,5): error TS2322: Type '(number[] | string[])[]' is not assignable to type 'tup'.
Expand All @@ -13,7 +13,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(33,5): error
Property '0' is missing in type 'number[]'.
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'.
Types of property 'push' are incompatible.
Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'.
Type '(this: (string | number)[], ...items: (string | number)[]) => number' is not assignable to type '(this: myArray, ...items: Number[]) => number'.
Types of parameters 'items' and 'items' are incompatible.
Type 'Number' is not assignable to type 'string | number'.
Type 'Number' is not assignable to type 'number'.
Expand Down Expand Up @@ -47,7 +47,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
~~~~~~~~
!!! error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => number'.
!!! error TS2322: Type '(this: [number, number, string, boolean]) => string | number | boolean' is not assignable to type '(this: [number, number]) => number'.
!!! error TS2322: Type 'string | number | boolean' is not assignable to type 'number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.

Expand Down Expand Up @@ -76,7 +76,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
~~
!!! error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'.
!!! error TS2322: Types of property 'push' are incompatible.
!!! error TS2322: Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'.
!!! error TS2322: Type '(this: (string | number)[], ...items: (string | number)[]) => number' is not assignable to type '(this: myArray, ...items: Number[]) => number'.
!!! error TS2322: Types of parameters 'items' and 'items' are incompatible.
!!! error TS2322: Type 'Number' is not assignable to type 'string | number'.
!!! error TS2322: Type 'Number' is not assignable to type 'number'.
Expand Down
Loading