BigBen
BigBen

Reputation: 23

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

Upvotes: 2

Views: 334

Answers (1)

toskv
toskv

Reputation: 31602

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.

Upvotes: 1

Related Questions