Closed
Description
π 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
π» 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 implementFooable
.
π Expected behavior
/** @implements {NS.Fooable} */
should not have an error, exactly likeimplements NS.Fooable
above.- Both versions of
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:
import * as NS from "./namespace";
However, this causes a runtime import that's only used for type information.
Related issues
- 'import type * as namespace' no longer can be used with 'implements'Β #36428 (The same issue using
import type
in TS instead of@import
in JSDoc)