question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What support for `@override` tags?

See original GitHub issue

I’m opening this issue in order to clarify what should be the appropriate behavior for @override tags.

As I’m working on making the tests pass on PR#98, I’m a bit confused with the output for the MyThing.copy() override in test/fixtures/class_all.js (see my commit be91778).

According to PR#11, I understand that we should prioritize the parent’s overridden doclet over the downclass’s overriding one (which sounds weird to me).

But according to PR#103, it seems that the port to jsdoc@3.6.3 led us to prioritize the downclass’s overriding doclet over the parent’s overridden one (which seems more logical to me). Indeed, jsdoc@3.6.3 raw output (jsdoc -X) differs from jsdoc@3.5.5, particularly with override doclets, especially with the final module:util~MyThing#copy doclets that receive the first module:util~MyThing#copy doclet in jsdoc@3.6.3 while it received the OtherThing#copy doclet in jsdoc@3.5.5.

If I get back to jsdoc documentation for @override tags, I understand that @override tags could be considered as optional, in as much as jsdoc automatically detects overrides without the help of @override. Nevertheless, when we remove the @override tag in test/fixtures/class_all.js, the raw jsdoc output is different:

  • jsdoc@3.5.5:
    • The first module:util~MyThing#copy doclet:
      • no longer has a "override": true attribute,
      • no longer has a "ignore": true attribute,
      • but receives a "overrides": "OtherThing#copy" attribute.
    • The final module:util~MyThing#copy doclet is not generated anymore.
  • jsdoc@3.6.6:
    • Same behavior for the first module:util~MyThing#copy doclet.
    • The final module:util~MyThing#copy docletS (two in a row) are not generated anymore.

On the typsecript side, it seems that in the PR#103 version of the test/expected/class_all.d.ts file, typescripts complains with the following error on MyThing.copy():

Property 'copy' in type 'MyThing' is not assignable to the same property in base type 'OtherThing'.
  Type '(other: OtherThing) => void' is not assignable to type '() => void'.

So, even though the PR#103 way looked more logical, it seems that it eventually leads to invalid typescript.

In the end, I have the feeling that ‘explicitly overridden members (i.e. a method that has a different signature)’ as named in PR#11 should not be handled. If so, the @override test case in test/fixtures/class_all.js could be removed.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
englercjcommented, Sep 19, 2019

Yes I think that is what the previous behavior was. If you inherit a method of the same name as one you have defined, we drop the child one.

I don’t feel strongly about the override warning, I’m OK either way.

0reactions
Alexis-ROYERcommented, Oct 3, 2019

Fix proposal in PR#98 with commit 8b205c65.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding template tags - django-pattern-library
Override modes​​ There are two options when it comes to template tag overriding: Render another template or pattern (a template with own fake ......
Read more >
How to override values of tags in OB1 with S7APP. - 267019
Hello,Using S7app i noticed that if i had programmed any logic of inputs before enabling some output to be turned on in OB1...
Read more >
Override HTML Tags - WordPress.org
I'm using read mode, legacy template and would like to know if I can override the head HTML attribute of the AMP post...
Read more >
Campaign Manager 360/Display & Video 360 auto-tagging ...
In the PROPERTY column, click Property Settings. Expand Advanced Settings. Select Allow manual tagging (UTM values) to override auto-tagging (DCLID values). ...
Read more >
Method to override git tags - TeamCity Support | JetBrains
Git's tag command can take a --force flag, which allows an existing tag to be overwritten. But the VCS labeling feature does not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found