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

@import * as namespace cannot be used with @implements #60563

Open
Peeja opened this issue Nov 22, 2024 · 0 comments Β· May be fixed by #60566
Open

@import * as namespace cannot be used with @implements #60563

Peeja opened this issue Nov 22, 2024 · 0 comments Β· May be fixed by #60566

Comments

@Peeja
Copy link
Contributor

Peeja commented Nov 22, 2024

πŸ”Ž Search Terms

  • cannot be used as a value because it was imported using 'import type'
  • implements

πŸ•— Version & Regression Information

  • I was unable to test this on prior versions (to v4.1.5) because every-ts failed to build them.

⏯ Playground Link

https://www.typescriptlang.org/dev/bug-workbench/?checkJs=true&allowJs=true&moduleResolution=3&target=9&module=100&ts=5.6.3#code/PTAEAEEMBtoewO4CkDOAoEEDGALAplgNapoZjgBmAltHgHaQC2eAXKA8ygA6RZ4B0AF3R4AHlzgAnQaCp1BeSRV55QAMThxIAI1qgA3mlCgKmgBQBKNgDc4VACYBuNAF9SZCNVodWoYQFoqRglpIXQgkJlBAE8uVQAqUEgUUAA5AGUTSThGUAAifmAfbhU85zQxSNAsaGSUgBUcOQBzRshBAGFIOg04WWDaZnkUjP5enT19N1JMShp6Jl8AKxRA4KlBfhWMePijRPAIjdBE5LTMimzcgHJC4p4+a-3gGd2ICMH6YQNR8d08FwnF6VY41OqgRotNqdbq9AxuIA

πŸ’» Code

// @allowJs
// @checkJs

// @filename: namespace.ts
export interface Fooable {
  foo(): void;
}


// @filename: ts-import.ts
import type * as NS from "./namespace";

export class ThingThatCanFoo implements NS.Fooable {}


// @filename: js-import.js
/**
 * @import * as NS from './namespace'
 */

/** @implements {NS.Fooable} */
export class ThingThatCanFoo {}

πŸ™ Actual behavior

  • /** @implements {NS.Fooable} */ has error: 'NS' cannot be used as a value because it was imported using 'import type'.
  • Both versions of ThingThatCanFoo correctly report that they do not fully implement Fooable.

πŸ™‚ Expected behavior

  • /** @implements {NS.Fooable} */ should not have an error, exactly like implements NS.Fooable above.
  • Both versions of ThingThatCanFoo should still report that they do not fully implement Fooable.

Additional information about the issue

Notably, in the JSDoc version, using a non-type import removes the error:

import * as NS from "./namespace";

However, this causes a runtime import that's only used for type information.

Related issues

@Peeja Peeja changed the title @import * as namespace' cannot be used with @implements` @import * as namespace' cannot be used with @implements Nov 22, 2024
@Peeja Peeja changed the title @import * as namespace' cannot be used with @implements @import * as namespace cannot be used with @implements Nov 22, 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

Successfully merging a pull request may close this issue.

1 participant