Skip to content

Commit c949543

Browse files
committed
Fix the indent for the parameter and typeparameter emit in .d.ts file
1 parent b8bbb0d commit c949543

File tree

7 files changed

+23
-19
lines changed

7 files changed

+23
-19
lines changed

src/compiler/emitter.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,7 +2260,9 @@ module ts {
22602260
};
22612261
}
22622262

2263+
increaseIndent();
22632264
emitJsDocComments(node);
2265+
decreaseIndent();
22642266
emitSourceTextOfNode(node.name);
22652267
// If there is constraint present and this is not a type parameter of the private method emit the constraint
22662268
if (node.constraint && (node.parent.kind !== SyntaxKind.Method || !(node.parent.flags & NodeFlags.Private))) {
@@ -2647,6 +2649,7 @@ module ts {
26472649
}
26482650

26492651
function emitParameterDeclaration(node: ParameterDeclaration) {
2652+
increaseIndent();
26502653
emitJsDocComments(node);
26512654
if (node.flags & NodeFlags.Rest) {
26522655
write("...");
@@ -2655,6 +2658,7 @@ module ts {
26552658
if (node.initializer || (node.flags & NodeFlags.QuestionMark)) {
26562659
write("?");
26572660
}
2661+
decreaseIndent();
26582662

26592663
if (!(node.parent.flags & NodeFlags.Private)) {
26602664
write(": ");

tests/baselines/reference/commentsFunction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ lambddaNoVarComment(10, 20);
5353
declare function foo(): void;
5454
/** This is comment for function signature*/
5555
declare function fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
56-
b: number): void;
56+
b: number): void;
5757
/** fooFunc
5858
* comment
5959
*/

tests/baselines/reference/declFileCallSignatures.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export interface ICallSignature {
7777
export interface ICallSignatureWithParameters {
7878
/** This is comment for function signature*/
7979
(/** this is comment about a*/ a: string, /** this is comment for b*/
80-
b: number): void;
80+
b: number): void;
8181
}
8282
export interface ICallSignatureWithRestParameters {
8383
(a: string, ...rests: string[]): string;
@@ -101,7 +101,7 @@ interface IGlobalCallSignature {
101101
interface IGlobalCallSignatureWithParameters {
102102
/** This is comment for function signature*/
103103
(/** this is comment about a*/ a: string, /** this is comment for b*/
104-
b: number): void;
104+
b: number): void;
105105
}
106106
interface IGlobalCallSignatureWithRestParameters {
107107
(a: string, ...rests: string[]): string;

tests/baselines/reference/declFileConstructSignatures.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export interface IConstructSignature {
7777
export interface IConstructSignatureWithParameters {
7878
/** This is comment for function signature*/
7979
new (/** this is comment about a*/ a: string, /** this is comment for b*/
80-
b: number): any;
80+
b: number): any;
8181
}
8282
export interface IConstructSignatureWithRestParameters {
8383
new (a: string, ...rests: string[]): string;
@@ -101,7 +101,7 @@ interface IGlobalConstructSignature {
101101
interface IGlobalConstructSignatureWithParameters {
102102
/** This is comment for function signature*/
103103
new (/** this is comment about a*/ a: string, /** this is comment for b*/
104-
b: number): any;
104+
b: number): any;
105105
}
106106
interface IGlobalConstructSignatureWithRestParameters {
107107
new (a: string, ...rests: string[]): string;

tests/baselines/reference/declFileConstructors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export declare class SimpleConstructor {
225225
export declare class ConstructorWithParameters {
226226
/** This is comment for function signature*/
227227
constructor(/** this is comment about a*/ a: string, /** this is comment for b*/
228-
b: number);
228+
b: number);
229229
}
230230
export declare class ConstructorWithRestParamters {
231231
constructor(a: string, ...rests: string[]);
@@ -258,7 +258,7 @@ declare class GlobalSimpleConstructor {
258258
declare class GlobalConstructorWithParameters {
259259
/** This is comment for function signature*/
260260
constructor(/** this is comment about a*/ a: string, /** this is comment for b*/
261-
b: number);
261+
b: number);
262262
}
263263
declare class GlobalConstructorWithRestParamters {
264264
constructor(a: string, ...rests: string[]);

tests/baselines/reference/declFileFunctions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function globalfooWithOverloads(a) {
126126
export declare function foo(): void;
127127
/** This is comment for function signature*/
128128
export declare function fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
129-
b: number): void;
129+
b: number): void;
130130
export declare function fooWithRestParameters(a: string, ...rests: string[]): string;
131131
export declare function fooWithOverloads(a: string): string;
132132
export declare function fooWithOverloads(a: number): number;
@@ -135,7 +135,7 @@ export declare function fooWithOverloads(a: number): number;
135135
declare function globalfoo(): void;
136136
/** This is comment for function signature*/
137137
declare function globalfooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
138-
b: number): void;
138+
b: number): void;
139139
declare function globalfooWithRestParameters(a: string, ...rests: string[]): string;
140140
declare function globalfooWithOverloads(a: string): string;
141141
declare function globalfooWithOverloads(a: number): number;

tests/baselines/reference/declFileMethods.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -355,31 +355,31 @@ export declare class c1 {
355355
foo(): void;
356356
/** This is comment for function signature*/
357357
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
358-
b: number): void;
358+
b: number): void;
359359
fooWithRestParameters(a: string, ...rests: string[]): string;
360360
fooWithOverloads(a: string): string;
361361
fooWithOverloads(a: number): number;
362362
/** This comment should appear for privateFoo*/
363363
private privateFoo();
364364
/** This is comment for function signature*/
365365
private privateFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
366-
b);
366+
b);
367367
private privateFooWithRestParameters(a, ...rests);
368368
private privateFooWithOverloads(a);
369369
private privateFooWithOverloads(a);
370370
/** This comment should appear for static foo*/
371371
static staticFoo(): void;
372372
/** This is comment for function signature*/
373373
static staticFooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
374-
b: number): void;
374+
b: number): void;
375375
static staticFooWithRestParameters(a: string, ...rests: string[]): string;
376376
static staticFooWithOverloads(a: string): string;
377377
static staticFooWithOverloads(a: number): number;
378378
/** This comment should appear for privateStaticFoo*/
379379
private static privateStaticFoo();
380380
/** This is comment for function signature*/
381381
private static privateStaticFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
382-
b);
382+
b);
383383
private static privateStaticFooWithRestParameters(a, ...rests);
384384
private static privateStaticFooWithOverloads(a);
385385
private static privateStaticFooWithOverloads(a);
@@ -389,7 +389,7 @@ export interface I1 {
389389
foo(): string;
390390
/** This is comment for function signature*/
391391
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
392-
b: number): void;
392+
b: number): void;
393393
fooWithRestParameters(a: string, ...rests: string[]): string;
394394
fooWithOverloads(a: string): string;
395395
fooWithOverloads(a: number): number;
@@ -400,31 +400,31 @@ declare class c2 {
400400
foo(): void;
401401
/** This is comment for function signature*/
402402
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
403-
b: number): void;
403+
b: number): void;
404404
fooWithRestParameters(a: string, ...rests: string[]): string;
405405
fooWithOverloads(a: string): string;
406406
fooWithOverloads(a: number): number;
407407
/** This comment should appear for privateFoo*/
408408
private privateFoo();
409409
/** This is comment for function signature*/
410410
private privateFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
411-
b);
411+
b);
412412
private privateFooWithRestParameters(a, ...rests);
413413
private privateFooWithOverloads(a);
414414
private privateFooWithOverloads(a);
415415
/** This comment should appear for static foo*/
416416
static staticFoo(): void;
417417
/** This is comment for function signature*/
418418
static staticFooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
419-
b: number): void;
419+
b: number): void;
420420
static staticFooWithRestParameters(a: string, ...rests: string[]): string;
421421
static staticFooWithOverloads(a: string): string;
422422
static staticFooWithOverloads(a: number): number;
423423
/** This comment should appear for privateStaticFoo*/
424424
private static privateStaticFoo();
425425
/** This is comment for function signature*/
426426
private static privateStaticFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
427-
b);
427+
b);
428428
private static privateStaticFooWithRestParameters(a, ...rests);
429429
private static privateStaticFooWithOverloads(a);
430430
private static privateStaticFooWithOverloads(a);
@@ -434,7 +434,7 @@ interface I2 {
434434
foo(): string;
435435
/** This is comment for function signature*/
436436
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
437-
b: number): void;
437+
b: number): void;
438438
fooWithRestParameters(a: string, ...rests: string[]): string;
439439
fooWithOverloads(a: string): string;
440440
fooWithOverloads(a: number): number;

0 commit comments

Comments
 (0)