Skip to content
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

JSDoc implements with imported types #60591

Open
VanillaMaster opened this issue Nov 25, 2024 · 0 comments
Open

JSDoc implements with imported types #60591

VanillaMaster opened this issue Nov 25, 2024 · 0 comments

Comments

@VanillaMaster
Copy link

🔎 Search Terms

Declaration emit for this file requires using private name '__type' from module '{path}'. An explicit type annotation may unblock declaration emit
implements
import
type
JSDoc

🕗 Version & Regression Information

This is the behavior in every version I tried (v5.5.4 - Nightly)

⏯ Playground Link

https://www.typescriptlang.org/play/?jsx=0&module=0&ts=5.5.4&filetype=js#code/PTAEAEDMEsBsFMB2BDAtvAXKSB7HA6AKwGcAoYAKgtNAogBcBPAB3gBN5JQBvH7PLMXoAnaIgDmoAL7TQAMTw0KwUuTBQ4SNJlAAjZMKJlKFcNFTMcw+nwU5ZkYTlSgARPmC4CJV7RXkqMwsEdER6Yh47GWVSAGNYZGIIgCEDPhBQAB4AWmzQABF4eINkemgcRFB4VGgbXGFQegALaAiYBFBheABHAFdoLoje4jFJZlEAN1L4UBR0UAByAH0lplYF-FAAQUr4AA9mWGhY2saWGeRERBx6UvLK1GRGUF7EXVgcWIBrUA5i4TuFSqNXo+BooAhXlAAF43AAWABMrgA3KQpEA

💻 Code

// @filename: foo.js
/**
 * @typedef { { foo: string } } Foo
 */

// @filename: bar.js
/**@import { Foo } from "./foo.js" */

/**@implements {Foo} */
class Bar { // <-- Declaration emit for this file requires using private name '__type'. An explicit type annotation may unblock declaration emit.
    foo = "42";
}

🙁 Actual behavior

Declaration emit for this file requires using private name '__type'. An explicit type annotation may unblock declaration emit

🙂 Expected behavior

no errors.
same code in typescript files works fine.

Additional information about the issue

if redefine type in the same file, error can be avoided

// @filename: foo.js
/**
 * @typedef { { foo: string } } Foo
 */

// @filename: bar.js
/**
 * @import { Foo } from "./foo.js"
 * @typedef { Foo } $Foo
 */

/**@implements {$Foo} */
class Bar { // <-- Ok
    foo = "42";
}
@VanillaMaster VanillaMaster changed the title JSDoc implements with imported JSDoc implements with imported types Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant