typedi icon indicating copy to clipboard operation
typedi copied to clipboard

question: Stage 3 decorator support (available since TS 5.0)

Open intellix opened this issue 1 year ago • 0 comments

I was trying to...

Use esbuild/swc to speed up compilation/build times and improve developer productivity and general experience

The problem:

typedi as far as I know currently uses and depends on reflect-metadata which was used for stage 2 decorator support. Since TypeScript 5.0 we've had stage 3 decorator support and as far as I know, that means you no longer need to rely on these two properties which esbuild states it does not support (https://esbuild.github.io/content-types/#no-type-system):

"emitDecoratorMetadata": true,
"experimentalDecorators": true,

I can see that trying to use the @Inject decorator in a constructor argument gives off a Decorators are not valid here.ts(1206) error:

constructor(@Inject(APP_CONFIG) appConfig) { ...}

Forgive my ignorance if I'm getting it all wrong and if it's supported today. If that's the case it would be helpful to display a notice explaining the support and how to achieve it (if so).

Potentially related: https://github.com/typestack/typedi/issues/783

intellix avatar Aug 26 '23 11:08 intellix