mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 07:29:16 -05:00
Fix signature help
This commit is contained in:
@@ -6,6 +6,19 @@ f1(1,);
|
||||
function f2(...args,) {}
|
||||
|
||||
f2(...[],);
|
||||
|
||||
// Not confused by overloads
|
||||
declare function f3(x, ): number;
|
||||
declare function f3(x, y,): string;
|
||||
|
||||
<number>f3(1,);
|
||||
<string>f3(1, 2,);
|
||||
|
||||
// Works for constructors too
|
||||
class X {
|
||||
constructor(a,) { }
|
||||
}
|
||||
new X(1,);
|
||||
|
||||
|
||||
//// [trailingCommasInFunctionParametersAndArguments.js]
|
||||
@@ -18,3 +31,12 @@ function f2() {
|
||||
}
|
||||
}
|
||||
f2.apply(void 0, []);
|
||||
f3(1);
|
||||
f3(1, 2);
|
||||
// Works for constructors too
|
||||
var X = (function () {
|
||||
function X(a) {
|
||||
}
|
||||
return X;
|
||||
}());
|
||||
new X(1);
|
||||
|
||||
@@ -13,3 +13,29 @@ function f2(...args,) {}
|
||||
f2(...[],);
|
||||
>f2 : Symbol(f2, Decl(trailingCommasInFunctionParametersAndArguments.ts, 2, 7))
|
||||
|
||||
// Not confused by overloads
|
||||
declare function f3(x, ): number;
|
||||
>f3 : Symbol(f3, Decl(trailingCommasInFunctionParametersAndArguments.ts, 6, 11), Decl(trailingCommasInFunctionParametersAndArguments.ts, 9, 33))
|
||||
>x : Symbol(x, Decl(trailingCommasInFunctionParametersAndArguments.ts, 9, 20))
|
||||
|
||||
declare function f3(x, y,): string;
|
||||
>f3 : Symbol(f3, Decl(trailingCommasInFunctionParametersAndArguments.ts, 6, 11), Decl(trailingCommasInFunctionParametersAndArguments.ts, 9, 33))
|
||||
>x : Symbol(x, Decl(trailingCommasInFunctionParametersAndArguments.ts, 10, 20))
|
||||
>y : Symbol(y, Decl(trailingCommasInFunctionParametersAndArguments.ts, 10, 22))
|
||||
|
||||
<number>f3(1,);
|
||||
>f3 : Symbol(f3, Decl(trailingCommasInFunctionParametersAndArguments.ts, 6, 11), Decl(trailingCommasInFunctionParametersAndArguments.ts, 9, 33))
|
||||
|
||||
<string>f3(1, 2,);
|
||||
>f3 : Symbol(f3, Decl(trailingCommasInFunctionParametersAndArguments.ts, 6, 11), Decl(trailingCommasInFunctionParametersAndArguments.ts, 9, 33))
|
||||
|
||||
// Works for constructors too
|
||||
class X {
|
||||
>X : Symbol(X, Decl(trailingCommasInFunctionParametersAndArguments.ts, 13, 18))
|
||||
|
||||
constructor(a,) { }
|
||||
>a : Symbol(a, Decl(trailingCommasInFunctionParametersAndArguments.ts, 17, 16))
|
||||
}
|
||||
new X(1,);
|
||||
>X : Symbol(X, Decl(trailingCommasInFunctionParametersAndArguments.ts, 13, 18))
|
||||
|
||||
|
||||
@@ -18,3 +18,38 @@ f2(...[],);
|
||||
>...[] : undefined
|
||||
>[] : undefined[]
|
||||
|
||||
// Not confused by overloads
|
||||
declare function f3(x, ): number;
|
||||
>f3 : { (x: any): number; (x: any, y: any): string; }
|
||||
>x : any
|
||||
|
||||
declare function f3(x, y,): string;
|
||||
>f3 : { (x: any): number; (x: any, y: any): string; }
|
||||
>x : any
|
||||
>y : any
|
||||
|
||||
<number>f3(1,);
|
||||
><number>f3(1,) : number
|
||||
>f3(1,) : number
|
||||
>f3 : { (x: any): number; (x: any, y: any): string; }
|
||||
>1 : number
|
||||
|
||||
<string>f3(1, 2,);
|
||||
><string>f3(1, 2,) : string
|
||||
>f3(1, 2,) : string
|
||||
>f3 : { (x: any): number; (x: any, y: any): string; }
|
||||
>1 : number
|
||||
>2 : number
|
||||
|
||||
// Works for constructors too
|
||||
class X {
|
||||
>X : X
|
||||
|
||||
constructor(a,) { }
|
||||
>a : any
|
||||
}
|
||||
new X(1,);
|
||||
>new X(1,) : X
|
||||
>X : typeof X
|
||||
>1 : number
|
||||
|
||||
|
||||
@@ -5,3 +5,16 @@ f1(1,);
|
||||
function f2(...args,) {}
|
||||
|
||||
f2(...[],);
|
||||
|
||||
// Not confused by overloads
|
||||
declare function f3(x, ): number;
|
||||
declare function f3(x, y,): string;
|
||||
|
||||
<number>f3(1,);
|
||||
<string>f3(1, 2,);
|
||||
|
||||
// Works for constructors too
|
||||
class X {
|
||||
constructor(a,) { }
|
||||
}
|
||||
new X(1,);
|
||||
|
||||
Reference in New Issue
Block a user