mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Declaration comments for parameters in .d.ts file
This commit is contained in:
parent
6bf73a691a
commit
b8bbb0d547
@ -2647,6 +2647,7 @@ module ts {
|
||||
}
|
||||
|
||||
function emitParameterDeclaration(node: ParameterDeclaration) {
|
||||
emitJsDocComments(node);
|
||||
if (node.flags & NodeFlags.Rest) {
|
||||
write("...");
|
||||
}
|
||||
|
||||
@ -476,14 +476,14 @@ declare class c1 {
|
||||
/** p1 is property of c1*/
|
||||
p1: number;
|
||||
/** sum with property*/
|
||||
p2(b: number): number;
|
||||
p2(/** number to add*/ b: number): number;
|
||||
/** getter property*/
|
||||
/** setter property*/
|
||||
p3: number;
|
||||
/** pp1 is property of c1*/
|
||||
private pp1;
|
||||
/** sum with property*/
|
||||
private pp2(b);
|
||||
private pp2(/** number to add*/ b);
|
||||
/** getter property*/
|
||||
/** setter property*/
|
||||
private pp3;
|
||||
@ -492,7 +492,7 @@ declare class c1 {
|
||||
/** s1 is static property of c1*/
|
||||
static s1: number;
|
||||
/** static sum with property*/
|
||||
static s2(b: number): number;
|
||||
static s2(/** number to add*/ b: number): number;
|
||||
/** static getter property*/
|
||||
/** setter property*/
|
||||
static s3: number;
|
||||
|
||||
@ -365,6 +365,6 @@ declare function divide(a: number, b: number): void;
|
||||
*@param a it is first parameter
|
||||
*@param c it is third parameter
|
||||
*/
|
||||
declare function jsDocParamTest(a: number, b: number, c: number, d: number): number;
|
||||
declare function jsDocParamTest(/** this is inline comment for a */ a: number, /** this is inline comment for b*/ b: number, c: number, d: number): number;
|
||||
declare class NoQuickInfoClass {
|
||||
}
|
||||
|
||||
@ -52,7 +52,8 @@ lambddaNoVarComment(10, 20);
|
||||
/** This comment should appear for foo*/
|
||||
declare function foo(): void;
|
||||
/** This is comment for function signature*/
|
||||
declare function fooWithParameters(a: string, b: number): void;
|
||||
declare function fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): void;
|
||||
/** fooFunc
|
||||
* comment
|
||||
*/
|
||||
|
||||
@ -118,16 +118,16 @@ interface i2 {
|
||||
/** this is foo*/
|
||||
foo: (b: number) => string;
|
||||
/** this is indexer*/
|
||||
[i: string]: any;
|
||||
[/**string param*/ i: string]: any;
|
||||
/**new method*/
|
||||
new (i: i1): any;
|
||||
new (/** param*/ i: i1): any;
|
||||
nc_x: number;
|
||||
nc_foo: (b: number) => string;
|
||||
[i: number]: number;
|
||||
/** this is call signature*/
|
||||
(a: number, b: number): number;
|
||||
(/**paramhelp a*/ a: number, /**paramhelp b*/ b: number): number;
|
||||
/** this is fnfoo*/
|
||||
fnfoo(b: number): string;
|
||||
fnfoo(/**param help*/ b: number): string;
|
||||
nc_fnfoo(b: number): string;
|
||||
nc_y: number;
|
||||
}
|
||||
@ -150,7 +150,7 @@ interface i3 {
|
||||
/** Comment i3 x*/
|
||||
x: number;
|
||||
/** Function i3 f*/
|
||||
f(a: number): string;
|
||||
f(/**number parameter*/ a: number): string;
|
||||
/** i3 l*/
|
||||
l: (b: number) => string;
|
||||
nc_x: number;
|
||||
|
||||
@ -285,7 +285,7 @@ declare module m1 {
|
||||
}
|
||||
/** exported function*/
|
||||
function fooExport(): number;
|
||||
function foo2Export(a: string): void;
|
||||
function foo2Export(/**hm*/ a: string): void;
|
||||
/** foo3Export
|
||||
* comment
|
||||
*/
|
||||
|
||||
@ -262,7 +262,7 @@ var c5_i_2 = new c5("hello");
|
||||
|
||||
//// [commentsOverloads.d.ts]
|
||||
/** this is signature 1*/
|
||||
declare function f1(a: number): number;
|
||||
declare function f1(/**param a*/ a: number): number;
|
||||
declare function f1(b: string): number;
|
||||
declare function f2(a: number): number;
|
||||
/** this is signature 2*/
|
||||
@ -270,12 +270,12 @@ declare function f2(b: string): number;
|
||||
declare function f3(a: number): number;
|
||||
declare function f3(b: string): number;
|
||||
/** this is signature 4 - with number parameter*/
|
||||
declare function f4(a: number): number;
|
||||
declare function f4(/**param a*/ a: number): number;
|
||||
/** this is signature 4 - with string parameter*/
|
||||
declare function f4(b: string): number;
|
||||
interface i1 {
|
||||
/**this signature 1*/
|
||||
(a: number): number;
|
||||
(/**param a*/ a: number): number;
|
||||
/**this is signature 2*/
|
||||
(b: string): number;
|
||||
/** foo 1*/
|
||||
|
||||
@ -149,7 +149,7 @@ var m1;
|
||||
/** Variable comments*/
|
||||
declare var myVariable: number;
|
||||
/** function comments*/
|
||||
declare function foo(p: number): void;
|
||||
declare function foo(/** parameter comment*/ p: number): void;
|
||||
/** variable with function type comment*/
|
||||
declare var fooVar: () => void;
|
||||
/**class comment*/
|
||||
|
||||
@ -76,7 +76,8 @@ export interface ICallSignature {
|
||||
}
|
||||
export interface ICallSignatureWithParameters {
|
||||
/** This is comment for function signature*/
|
||||
(a: string, b: number): void;
|
||||
(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): void;
|
||||
}
|
||||
export interface ICallSignatureWithRestParameters {
|
||||
(a: string, ...rests: string[]): string;
|
||||
@ -99,7 +100,8 @@ interface IGlobalCallSignature {
|
||||
}
|
||||
interface IGlobalCallSignatureWithParameters {
|
||||
/** This is comment for function signature*/
|
||||
(a: string, b: number): void;
|
||||
(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): void;
|
||||
}
|
||||
interface IGlobalCallSignatureWithRestParameters {
|
||||
(a: string, ...rests: string[]): string;
|
||||
|
||||
@ -76,7 +76,8 @@ export interface IConstructSignature {
|
||||
}
|
||||
export interface IConstructSignatureWithParameters {
|
||||
/** This is comment for function signature*/
|
||||
new (a: string, b: number): any;
|
||||
new (/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): any;
|
||||
}
|
||||
export interface IConstructSignatureWithRestParameters {
|
||||
new (a: string, ...rests: string[]): string;
|
||||
@ -99,7 +100,8 @@ interface IGlobalConstructSignature {
|
||||
}
|
||||
interface IGlobalConstructSignatureWithParameters {
|
||||
/** This is comment for function signature*/
|
||||
new (a: string, b: number): any;
|
||||
new (/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): any;
|
||||
}
|
||||
interface IGlobalConstructSignatureWithRestParameters {
|
||||
new (a: string, ...rests: string[]): string;
|
||||
|
||||
@ -224,7 +224,8 @@ export declare class SimpleConstructor {
|
||||
}
|
||||
export declare class ConstructorWithParameters {
|
||||
/** This is comment for function signature*/
|
||||
constructor(a: string, b: number);
|
||||
constructor(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number);
|
||||
}
|
||||
export declare class ConstructorWithRestParamters {
|
||||
constructor(a: string, ...rests: string[]);
|
||||
@ -256,7 +257,8 @@ declare class GlobalSimpleConstructor {
|
||||
}
|
||||
declare class GlobalConstructorWithParameters {
|
||||
/** This is comment for function signature*/
|
||||
constructor(a: string, b: number);
|
||||
constructor(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number);
|
||||
}
|
||||
declare class GlobalConstructorWithRestParamters {
|
||||
constructor(a: string, ...rests: string[]);
|
||||
|
||||
@ -125,7 +125,8 @@ function globalfooWithOverloads(a) {
|
||||
/** This comment should appear for foo*/
|
||||
export declare function foo(): void;
|
||||
/** This is comment for function signature*/
|
||||
export declare function fooWithParameters(a: string, b: number): void;
|
||||
export declare function fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): void;
|
||||
export declare function fooWithRestParameters(a: string, ...rests: string[]): string;
|
||||
export declare function fooWithOverloads(a: string): string;
|
||||
export declare function fooWithOverloads(a: number): number;
|
||||
@ -133,7 +134,8 @@ export declare function fooWithOverloads(a: number): number;
|
||||
/** This comment should appear for foo*/
|
||||
declare function globalfoo(): void;
|
||||
/** This is comment for function signature*/
|
||||
declare function globalfooWithParameters(a: string, b: number): void;
|
||||
declare function globalfooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): void;
|
||||
declare function globalfooWithRestParameters(a: string, ...rests: string[]): string;
|
||||
declare function globalfooWithOverloads(a: string): string;
|
||||
declare function globalfooWithOverloads(a: number): number;
|
||||
|
||||
@ -354,28 +354,32 @@ export declare class c1 {
|
||||
/** This comment should appear for foo*/
|
||||
foo(): void;
|
||||
/** This is comment for function signature*/
|
||||
fooWithParameters(a: string, b: number): void;
|
||||
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): void;
|
||||
fooWithRestParameters(a: string, ...rests: string[]): string;
|
||||
fooWithOverloads(a: string): string;
|
||||
fooWithOverloads(a: number): number;
|
||||
/** This comment should appear for privateFoo*/
|
||||
private privateFoo();
|
||||
/** This is comment for function signature*/
|
||||
private privateFooWithParameters(a, b);
|
||||
private privateFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
|
||||
b);
|
||||
private privateFooWithRestParameters(a, ...rests);
|
||||
private privateFooWithOverloads(a);
|
||||
private privateFooWithOverloads(a);
|
||||
/** This comment should appear for static foo*/
|
||||
static staticFoo(): void;
|
||||
/** This is comment for function signature*/
|
||||
static staticFooWithParameters(a: string, b: number): void;
|
||||
static staticFooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): void;
|
||||
static staticFooWithRestParameters(a: string, ...rests: string[]): string;
|
||||
static staticFooWithOverloads(a: string): string;
|
||||
static staticFooWithOverloads(a: number): number;
|
||||
/** This comment should appear for privateStaticFoo*/
|
||||
private static privateStaticFoo();
|
||||
/** This is comment for function signature*/
|
||||
private static privateStaticFooWithParameters(a, b);
|
||||
private static privateStaticFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
|
||||
b);
|
||||
private static privateStaticFooWithRestParameters(a, ...rests);
|
||||
private static privateStaticFooWithOverloads(a);
|
||||
private static privateStaticFooWithOverloads(a);
|
||||
@ -384,7 +388,8 @@ export interface I1 {
|
||||
/** This comment should appear for foo*/
|
||||
foo(): string;
|
||||
/** This is comment for function signature*/
|
||||
fooWithParameters(a: string, b: number): void;
|
||||
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): void;
|
||||
fooWithRestParameters(a: string, ...rests: string[]): string;
|
||||
fooWithOverloads(a: string): string;
|
||||
fooWithOverloads(a: number): number;
|
||||
@ -394,28 +399,32 @@ declare class c2 {
|
||||
/** This comment should appear for foo*/
|
||||
foo(): void;
|
||||
/** This is comment for function signature*/
|
||||
fooWithParameters(a: string, b: number): void;
|
||||
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): void;
|
||||
fooWithRestParameters(a: string, ...rests: string[]): string;
|
||||
fooWithOverloads(a: string): string;
|
||||
fooWithOverloads(a: number): number;
|
||||
/** This comment should appear for privateFoo*/
|
||||
private privateFoo();
|
||||
/** This is comment for function signature*/
|
||||
private privateFooWithParameters(a, b);
|
||||
private privateFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
|
||||
b);
|
||||
private privateFooWithRestParameters(a, ...rests);
|
||||
private privateFooWithOverloads(a);
|
||||
private privateFooWithOverloads(a);
|
||||
/** This comment should appear for static foo*/
|
||||
static staticFoo(): void;
|
||||
/** This is comment for function signature*/
|
||||
static staticFooWithParameters(a: string, b: number): void;
|
||||
static staticFooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): void;
|
||||
static staticFooWithRestParameters(a: string, ...rests: string[]): string;
|
||||
static staticFooWithOverloads(a: string): string;
|
||||
static staticFooWithOverloads(a: number): number;
|
||||
/** This comment should appear for privateStaticFoo*/
|
||||
private static privateStaticFoo();
|
||||
/** This is comment for function signature*/
|
||||
private static privateStaticFooWithParameters(a, b);
|
||||
private static privateStaticFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
|
||||
b);
|
||||
private static privateStaticFooWithRestParameters(a, ...rests);
|
||||
private static privateStaticFooWithOverloads(a);
|
||||
private static privateStaticFooWithOverloads(a);
|
||||
@ -424,7 +433,8 @@ interface I2 {
|
||||
/** This comment should appear for foo*/
|
||||
foo(): string;
|
||||
/** This is comment for function signature*/
|
||||
fooWithParameters(a: string, b: number): void;
|
||||
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
|
||||
b: number): void;
|
||||
fooWithRestParameters(a: string, ...rests: string[]): string;
|
||||
fooWithOverloads(a: string): string;
|
||||
fooWithOverloads(a: number): number;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user