-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Milestone
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-tsfailed 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
ThingThatCanFoocorrectly report that they do not fully implementFooable.
π Expected behavior
/** @implements {NS.Fooable} */should not have an error, exactly likeimplements NS.Fooableabove.- Both versions of
ThingThatCanFooshould 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 typein TS instead of@importin JSDoc)