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.

Support `@abstract` JSDoc tag

See original GitHub issue

TypeScript Version: nightly (2.5.0-dev.20170712)

Code

/** @abstract */
class C {}
new C();

Expected behavior:

Error.

Actual behavior:

No error.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:27
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

15reactions
tschaubcommented, Sep 1, 2018

Adding a bit more to this, it would be nice if @abstract on methods were supported.

For example, with this code:

/**
 * @abstract
 */
class Integer {
  /**
   * @abstract
   * @return {number} A number.
   */
  get() {}
}
 
class FortyTwo extends Integer {
  get() {
    return 42
  }
}


/**
 * @returns {number} The return.
 */
function getFortyTwo() {
  const number = new FortyTwo();
  return number.get();
}

tsc --pretty (at 3.1.0-dev.20180901) results in this error:

main.js:8:15 - error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.

8    * @return {number} A number.
                ~~~~~~
4reactions
ShikChencommented, Mar 12, 2021

When trying to migrate the type checker of a large JS codebase from Closure Compiler to Typescript, we found that lacking @abstract support is the major blocker. It would be great if the PR can be merged, and we are willing to test it for our codebase if needed 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use JSDoc: @abstract
The @abstract tag identifies members that must be implemented (or overridden) by objects that inherit the member. Example. Parent class with abstract method, ......
Read more >
javascript - @abstract class - jsDoc
Here only a method is tagged as an abstract entity. But can we add @abstract tag to Implementator class (function constructor) itself like ......
Read more >
JSDoc Reference - TypeScript: Documentation
The list below outlines which constructs are currently supported when using JSDoc annotations to provide type information in JavaScript files. Note any tags...
Read more >
Improve support for JSDoc @abstract/@interface with ES6 ...
Improve support for JSDoc @abstract/@interface with ES6 classes ... to copying the base JSDoc, but prohibits other tags - so we need to...
Read more >
All Tags
Documentation tags are similar to JSDoc tags. e.g. /** * this is MyClass description. ... @todo support multi byte character. ... syntax: @abstract...
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