Skip to content

Bump TS devDep to 5.3, hack dtsBundler to remove new comments #56554

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

Merged
merged 6 commits into from
Nov 27, 2023

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Nov 27, 2023

The package-lock bumper is failing because it sees that tests fail after updating deps.

This was caused by #50097 which started emitting more comments. Since our dts bundler is very naive and just prints nodes as-is, this means that we'll include non-JSDoc comments too, which isn't super desirable.

This turns out to probably not be super great for dts emit; see the dts emit here: Playground Link

For now, I've just used internal APIs to override the comment writing function to avoid emitting // comments entirely, which lets us bump TS. Thankfully, I chose to dprint the output of the bundler, so the hack doesn't cause a diff due to stray spaces left in after my hack.

Probably we should be figuring out if dts emit should even output these kinds of comments, and also if the printing system should let you disable the emitting of non-jsdoc comments. That or I've missed something and that other PR was just wrong.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Nov 27, 2023
Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

wow, that is hacky!

@@ -78,7 +78,7 @@
"playwright": "^1.38.0",
Copy link
Member

Choose a reason for hiding this comment

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

this reminds me that we devdep on playwright =(

Copy link
Member Author

@jakebailey jakebailey Nov 27, 2023

Choose a reason for hiding this comment

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

It's not a big deal; as of 1.38 the package only depends on playwright-core (which is dependency free) and does not install browsers unless requested. The pair of packages is 2-3x smaller than the TypeScript package itself. I actually added this intentionally to simplify our builds once the change was made.

@fatcerberus
Copy link

and also if the printing system should let you disable the emitting of non-jsdoc comments

Sounds suspiciously like #38427

@jakebailey
Copy link
Member Author

Funkily we already emitted some comments in places like parameter lists even in declaration emit, so this is nothing new: Playground Link

Since the dts bundler works off of the dts code that tsc emits, these comments are all actually appearing in the real dts files. The dts bundler does not actually run off of the original source at all.

@jakebailey jakebailey merged commit b334e07 into microsoft:main Nov 27, 2023
@jakebailey jakebailey deleted the update-ts branch November 27, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants