当前位置: 动力学知识库 > 问答 > 编程问答 >

How to remove private members and keep comments in auto generated typescript definition files

问题描述:

I have two questions about the typesript compiler.

I use the autogenerating definition feature of the typescript compiler. The result includes private symbols:

export declare class WorkerController {

static LIBRARY_ROOT_PATH: string;

private _worker;

private _entryPoint;

private _externalScripts;

constructor(entryPoint: string, externalScript?: Array<string>);

spawn(): void;

private _test();

}

Is it possible to not include these?

I would also like to include the documentation comments that I have on my code. Is there a special keyword to preserve those?

thx

网友答案:

There is no way to stop emitting declarations for the private variables and functions.

Assuming that you have a tsconfig.json or a similar way to configure tsc you can set the removeComments option to false.

If set to false documentation comments will be left in the source. A documentation comment must start with /** instead of /* or //.

You can find more info on configuring tsc here.

分享给朋友:
您可能感兴趣的文章:
随机阅读: