Skip to content

Support emitDecoratorMetadata with TypeScript 7 #4500

Description

@iFlyinq

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions