-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
TS JSDoc visibility error #41672
Comments
Not sure whether @sandersn or @weswigham is the right person to take a look at this. I’m also not 100% sure if the example as given can compile, but the visibility error still appears when you annotate the declaration with |
So, first caveat: You need an explicit So, rundown:
Those won't fix anything right now, but will in the future once in TS we:
|
where do you say i need Shouldn’t we be able to |
Nope - a typedef defines a new type, not an alias to all meanings (as a proper import does). |
@hugomrdias Can you explain more about your scenario. WIth no other context, this seems like a rare usage of @weswigham Let's use this issue to track better emit errors on this comment, since you already fixed the node-reuse bug. |
Later: The error is actually on the sourcefile, which causes it to be issued on the first statement, not necessarily the host statement of the typedef. The sourcefile is a fallback error node when none is returned from isSymbolAccessible. |
#42501 improves the error span for jsdoc type aliases, which technically fixes this bug. However, there's more work to do on jsdoc tags that are not also type declarations, like |
I believe I'm hitting a similar error that also came up in #42405 In my case, I have a class that is not implementing the const { EventEmitter } = require('node:events');
class CustomEE extends EventEmitter { }
module.exports = CustomEE; And this is causing a When I update the constructor to: class CustomEE extends EventEmitter {
constructor(options) {
super(options)
}
} the error goes away and the declaration compiles. This behavior is unexpected because afaik it is valid to not implement the constructor method in JS. I don't want to have to introduce extra JS code here. |
TypeScript Version: 4.1.2
Search Terms:
An explicit type annotation may unblock declaration emit
private name
Code
https://codesandbox.io/s/tsc-ts-docs-visibility-repro-f73gw?file=/src/index.js
Expected behavior:
No error from the compiler
Actual behavior:
Playground Link:
https://codesandbox.io/s/tsc-ts-docs-visibility-repro-f73gw?file=/src/index.js
Related Issues:
#37832
#41250
The text was updated successfully, but these errors were encountered: