microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.21k stars 12.51k forks source link

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

Open Peeja opened 2 days ago

Peeja commented 2 days ago

🔎 Search Terms

🕗 Version & Regression Information

⏯ 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

🙂 Expected behavior

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