π Search Terms
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about the JSDoc tag
@implements
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.5.0-beta&filetype=js#code/PQKhAIAEEsFsAcA2BTWyB2AXAzuA3nPAPYBOmAFAEQCGlAlAHQBCAvuCMAFADGi12uAIL4WQA
π» Code
/** @implements {import("a").B} */
class A {}
π Actual behavior
Two TypeScript errors:
Cannot find name 'import'. (2304)
'}' expected. (2304)
π Expected behavior
TypeScript should allow using import() types within the type of the JSDoc tag @implements.
Additional information about the issue
A workaround is to use a JSDoc @typedef to import the type under an alias, and then use that alias within the JSDoc tag @implements type, e.g:
/** @typedef {import("a").B} B */
/** @implements {B} */
class A {}
π Search Terms
import@implements2304π Version & Regression Information
@implementsβ― Playground Link
https://www.typescriptlang.org/play/?ts=5.5.0-beta&filetype=js#code/PQKhAIAEEsFsAcA2BTWyB2AXAzuA3nPAPYBOmAFAEQCGlAlAHQBCAvuCMAFADGi12uAIL4WQA
π» Code
π Actual behavior
Two TypeScript errors:
Cannot find name 'import'.(2304)'}' expected.(2304)π Expected behavior
TypeScript should allow using
import()types within the type of the JSDoc tag@implements.Additional information about the issue
A workaround is to use a JSDoc
@typedefto import the type under an alias, and then use that alias within the JSDoc tag@implementstype, e.g: