mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Correct the declaration emit for overload implementation if there is single overload signature
Fixes #480
This commit is contained in:
@@ -21,6 +21,11 @@ export function fooWithOverloads(a: any): any {
|
||||
return a;
|
||||
}
|
||||
|
||||
export function fooWithSingleOverload(a: string): string;
|
||||
export function fooWithSingleOverload(a: any) {
|
||||
return a;
|
||||
}
|
||||
|
||||
/** This comment should appear for nonExportedFoo*/
|
||||
function nonExportedFoo() {
|
||||
}
|
||||
@@ -83,6 +88,10 @@ function fooWithOverloads(a) {
|
||||
return a;
|
||||
}
|
||||
exports.fooWithOverloads = fooWithOverloads;
|
||||
function fooWithSingleOverload(a) {
|
||||
return a;
|
||||
}
|
||||
exports.fooWithSingleOverload = fooWithSingleOverload;
|
||||
/** This comment should appear for nonExportedFoo*/
|
||||
function nonExportedFoo() {
|
||||
}
|
||||
@@ -134,6 +143,7 @@ export declare function fooWithParameters(/** this is comment about a*/ a: strin
|
||||
export declare function fooWithRestParameters(a: string, ...rests: string[]): string;
|
||||
export declare function fooWithOverloads(a: string): string;
|
||||
export declare function fooWithOverloads(a: number): number;
|
||||
export declare function fooWithSingleOverload(a: string): string;
|
||||
//// [declFileFunctions_1.d.ts]
|
||||
/** This comment should appear for foo*/
|
||||
declare function globalfoo(): void;
|
||||
|
||||
@@ -47,6 +47,18 @@ export function fooWithOverloads(a: any): any {
|
||||
>a : any
|
||||
}
|
||||
|
||||
export function fooWithSingleOverload(a: string): string;
|
||||
>fooWithSingleOverload : (a: string) => string
|
||||
>a : string
|
||||
|
||||
export function fooWithSingleOverload(a: any) {
|
||||
>fooWithSingleOverload : (a: string) => string
|
||||
>a : any
|
||||
|
||||
return a;
|
||||
>a : any
|
||||
}
|
||||
|
||||
/** This comment should appear for nonExportedFoo*/
|
||||
function nonExportedFoo() {
|
||||
>nonExportedFoo : () => void
|
||||
|
||||
@@ -23,6 +23,11 @@ export function fooWithOverloads(a: any): any {
|
||||
return a;
|
||||
}
|
||||
|
||||
export function fooWithSingleOverload(a: string): string;
|
||||
export function fooWithSingleOverload(a: any) {
|
||||
return a;
|
||||
}
|
||||
|
||||
/** This comment should appear for nonExportedFoo*/
|
||||
function nonExportedFoo() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user