Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api-extractor] How to remove redundant new lines of trimmed variables? #4788

Open
xiasun opened this issue Jun 17, 2024 · 0 comments
Open

Comments

@xiasun
Copy link

xiasun commented Jun 17, 2024

Summary

How to remove redundant newlines on trimmed members?

Repro steps

I want to trim internal members in my public release.

Let's say a sample .d.ts file is as follow

export class SampleClass {

    /** @internal */
    private _member1;

    /** @internal */
    private _member2;

    /** @internal */
    private _member3;

    /** @internal */
    private _member4;

    /** @internal */
    private _member5;

    /** @public */
    constructor();

    /** @public */
    public member1;

    /** @public */
    public member2;

}

My config file is an initially created one, and I just update dstRollup part as follow

"dtsRollup": {
    "enabled": true,
    "untrimmedFilePath": "<projectFolder>/dist/sdk/splat/sdk/index.d.ts",
    "publicTrimmedFilePath": "<projectFolder>/dist/sdk/splat/splat.d.ts",
    "omitTrimmingComments": true
},

The generated release has multiple newlines for the trimmed internal members

export class SampleClass {










    /** @public */
    constructor();

    /** @public */
    public member1;

    /** @public */
    public member2;

}

Expected result:

export class SampleClass {

    /** @public */
    constructor();

    /** @public */
    public member1;

    /** @public */
    public member2;

}

Actual result:

export class SampleClass {










    /** @public */
    constructor();

    /** @public */
    public member1;

    /** @public */
    public member2;

}

Details

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 7.43.0
Operating system? Windows
API Extractor scenario? config above
Would you consider contributing a PR? Yes
TypeScript compiler version? 5.0.4
Node.js version (node -v)? 19.4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: AE/AD
Development

No branches or pull requests

1 participant