Skip to content

Exclude JSDoc @extends from 'super()' checks#29308

Merged
sandersn merged 2 commits intomicrosoft:masterfrom
ajafff:jsdoc-extends-super
Jan 9, 2019
Merged

Exclude JSDoc @extends from 'super()' checks#29308
sandersn merged 2 commits intomicrosoft:masterfrom
ajafff:jsdoc-extends-super

Conversation

@ajafff
Copy link
Copy Markdown
Contributor

@ajafff ajafff commented Jan 8, 2019

This fixes a similar problem as #29244 where JSDoc @extends is treated as class X extends

This fixes a similar problem as microsoft#29244 where JSDoc `@extends`
@sheetalkamat sheetalkamat requested a review from sandersn January 8, 2019 17:05
@sandersn
Copy link
Copy Markdown
Member

sandersn commented Jan 8, 2019

@ajafff I think this bug needs more discussion; @extends with classes is intended to augment the extends clause of a class. It's only intended for use when type parameters need to be passed:

/** @extends {Array<number>} */
class Numbers extends Array {
}

I think the extends jsdoc should be ignored unless it has a matching extends clause. That would mean a change to getEffectiveBaseTypeNode to only return getJSDocAugmentTag if that tag has a matching extends clause.

Copy link
Copy Markdown
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.

Need more discussion of the bug and how to fix it.

Comment thread tests/cases/compiler/checkSuperCallBeforeThisAccessing9.ts
@ajafff
Copy link
Copy Markdown
Contributor Author

ajafff commented Jan 8, 2019

@sandersn I think that's different from the changes in this PR.
These checks shouldn't care about JSDoc at all. So it's actually unnecessary to keep using getEffectiveBaseTypeNode for them.

In a follow-up PR getEffectiveBaseTypeNode could be changed to only look at JSDoc if there's an extends clause.

@sandersn
Copy link
Copy Markdown
Member

sandersn commented Jan 9, 2019

@ajafff you are right, I read the intent of the change backward and now that you added the error on referencing super() in the second test case, it makes sense to me. Thanks!

@sandersn sandersn merged commit b52a7fc into microsoft:master Jan 9, 2019
errendir added a commit to errendir/TypeScript that referenced this pull request Jan 14, 2019
* origin/master: (1082 commits)
  Fix unneeded cast lints (microsoft#29383)
  Extracted compilerOptions setting to helper function
  Added codefix to enable experimentalDecorators in the user's config file
  Add tests for noLib with <reference lib> and bundling.
  Add tests for noLib with <reference lib>.
  Do not process library reference directives with noLib set.
  emit jsx type arguments
  Allow circular umd-merged-with-augmentation refs to resolve to the module as intended (microsoft#29335)
  Allow nonnull assertions in references (microsoft#29351)
  Accept new baselines
  Add regression tests
  Improve logic that determines when to resolve conditional types
  Update user baselines (microsoft#29336)
  Fix crash (microsoft#29333)
  Exclude JSDoc @extends from 'super()' checks (microsoft#29308)
  Fix existing test
  Verify that completion with new identifier location returns isNewIdentifierLocation: true Fixes microsoft#24009
  Fix the failing test case
  There is no need to check for file presence when trying to rename imports based on file rename Fixes microsoft#29031
  Fix gulp baseline-accept (microsoft#29301)
  ...
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants