Skip to content

Fix for jsdoc modifiers on constructor params #38403

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 2 commits into from
May 11, 2020
Merged

Fix for jsdoc modifiers on constructor params #38403

merged 2 commits into from
May 11, 2020

Conversation

rbuckton
Copy link
Member

@rbuckton rbuckton commented May 7, 2020

When we added support for @public, @private, @protected, @readonly JSDoc-style modifiers, we inadvertently treated such modifiers on constructor properties as if they were TypeScript "parameter property modifiers", resulting in comments in a JS source file affecting JS emit.

This PR splits the various "modifier"-related functions into "syntactic" and "effective" forms, where "syntactic" modifiers are derived from syntax, and "effective" modifiers including both the syntactic modifiers as well as modifiers derived from "jsdoc" comments.

Fixes #38401

/cc @DanielRosenwasser, @RyanCavanaugh in case we decide to take this for 3.9.

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.

I think the basic approach is a good idea. Hats off for updating every single usage.

Couple of questions and individual usage, and I think this should not go into 3.9 because our test coverage is so poor in this area; I'd like to have people use it for quite a while first.

@rbuckton
Copy link
Member Author

rbuckton commented May 8, 2020

I've updated based on feedback.

@rbuckton
Copy link
Member Author

rbuckton commented May 8, 2020

@sandersn can you take another look?

@rbuckton rbuckton merged commit d07e866 into master May 11, 2020
@rbuckton rbuckton deleted the fix38401 branch May 11, 2020 22:07
cangSDARM added a commit to cangSDARM/TypeScript that referenced this pull request May 12, 2020
* upstream/master: (54 commits)
  LEGO: check in for master to temporary branch.
  LEGO: check in for master to temporary branch.
  Fix for jsdoc modifiers on constructor params (microsoft#38403)
  Improve assert message in binder (microsoft#38270)
  fix broken regex on "src/services/completions.ts#getCompletionData" (microsoft#37546)
  report error for duplicate @type declaration (microsoft#38340)
  fix(38073): hide 'Extract to function in global scope' action for arrow functions which use 'this' (microsoft#38107)
  Update user baselines (microsoft#38472)
  Update user baselines (microsoft#38405)
  Changed template strings to emit void 0 instead of undefined (microsoft#38430)
  Fix js missing type arguments on existing nodes and jsdoc object literal declaration emit (microsoft#38368)
  LEGO: check in for master to temporary branch.
  Make isDynamicFileName available publicly (microsoft#38269)
  LEGO: check in for master to temporary branch.
  LEGO: check in for master to temporary branch.
  Exclude arrays and tuples from full intersection property check (microsoft#38395)
  Fix crash caused by assertion with evolving array type (microsoft#38398)
  Update user baselines (microsoft#38128)
  LEGO: check in for master to temporary branch.
  moveToNewFile: handle namespace imports too
  ...

# Conflicts:
#	src/compiler/types.ts
#	src/compiler/utilities.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression: JSDoc '@public' comment on constructor parameter affects JS emit
3 participants