Open Peeja opened 2 days ago
cannot be used as a value because it was imported using 'import type'
implements
every-ts
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
// @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 {}
/** @implements {NS.Fooable} */
'NS' cannot be used as a value because it was imported using 'import type'.
ThingThatCanFoo
Fooable
implements NS.Fooable
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
import type
@import
🔎 Search Terms
cannot be used as a value because it was imported using 'import type'
implements
🕗 Version & Regression Information
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
🙁 Actual behavior
/** @implements {NS.Fooable} */
has error:'NS' cannot be used as a value because it was imported using 'import type'.
ThingThatCanFoo
correctly report that they do not fully implementFooable
.🙂 Expected behavior
/** @implements {NS.Fooable} */
should not have an error, exactly likeimplements NS.Fooable
above.ThingThatCanFoo
should still report that they do not fully implementFooable
.Additional information about the issue
Notably, in the JSDoc version, using a non-type import removes the error:
However, this causes a runtime import that's only used for type information.
Related issues
import type
in TS instead of@import
in JSDoc)