Problem
The emitDecoratorMetadata() build extension loads the consumer's typescript package and uses the legacy JavaScript compiler API. TypeScript 7 does not expose that API, so projects using TypeScript 7 cannot currently use the extension.
Reported in #4500.
Approach
Resolve TypeScript from the project and feature-detect transpileModule. Continue using the project's compiler for TypeScript 5 and 6. For TypeScript 7, fall back to Microsoft's side-by-side @typescript/typescript6 compatibility package when installed. If neither compiler API is available, return an actionable installation error.
Declare the compatibility package as an optional peer so ordinary CLI users do not install the TypeScript 6 compiler. Add coverage for TypeScript 5/6, TypeScript 7 without compatibility support, and TypeScript 7 with the compatibility package. Update the extension documentation with the TypeScript 7 setup.
Problem
The
emitDecoratorMetadata()build extension loads the consumer'stypescriptpackage and uses the legacy JavaScript compiler API. TypeScript 7 does not expose that API, so projects using TypeScript 7 cannot currently use the extension.Reported in #4500.
Approach
Resolve TypeScript from the project and feature-detect
transpileModule. Continue using the project's compiler for TypeScript 5 and 6. For TypeScript 7, fall back to Microsoft's side-by-side@typescript/typescript6compatibility package when installed. If neither compiler API is available, return an actionable installation error.Declare the compatibility package as an optional peer so ordinary CLI users do not install the TypeScript 6 compiler. Add coverage for TypeScript 5/6, TypeScript 7 without compatibility support, and TypeScript 7 with the compatibility package. Update the extension documentation with the TypeScript 7 setup.