Skip to content

doc: fix stripTypeScriptTypes sourceUrl example output - #68025

Open
vansharora21 wants to merge 1 commit into
nodejs:mainfrom
vansharora21:doc-strip-types-sourceurl-output
Open

vansharora21 wants to merge 1 commit into
nodejs:mainfrom
vansharora21:doc-strip-types-sourceurl-output

Conversation

@vansharora21

Copy link
Copy Markdown

The documented output of the module.stripTypeScriptTypes() example with sourceUrl puts the semicolon after the appended //# sourceURL comment. The semicolon is part of the stripped code, so it comes first:

$ node -e "const { stripTypeScriptTypes } = require('node:module'); console.log(JSON.stringify(stripTypeScriptTypes('const a: number = 1;', { mode: 'strip', sourceUrl: 'source.ts' })))"
"const a         = 1;\n\n//# sourceURL=source.ts"

Fixed in both the ESM and CJS examples.

I used an AI coding assistant to help find this mismatch. I verified the output myself with Node.js v24.15.0.

The semicolon is part of the stripped code, so it comes before the
appended sourceURL comment, not after it.

Signed-off-by: vansharora21 <vansharora4903@gmail.com>
Copilot AI balanced review requested due to automatic review settings December 5, 2026 08:40
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/loaders

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to Node.js documentation. module Issues and PRs related to the module subsystem. labels Dec 5, 2026
@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to Node.js documentation. module Issues and PRs related to the module subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants