Coder Social home page Coder Social logo

Comments (5)

intellix avatar intellix commented on June 1, 2024 3

esbuild states that it doesn't support Decorator Metadata: https://esbuild.github.io/content-types/#no-type-system so I'm not sure how you're getting it to work with that? do you have a transformation step beforehand?

Tried removing it and relying on the new stage 3 decorators, available in TS 5.0: https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#decorators but I get warnings that I can't use @Inject within a constructor:

constructor(
  @Inject(APP_CONFIG) private appConfig: AppConfig,
) {}

I'm guessing to use stage 3 I'd need to refactor that to look like this?

constructor() {
  this.appConfig = Container.get(APP_CONFIG);
}

When I look at the spec for stage 3 decorators: https://github.com/tc39/proposal-decorators#access-and-metadata-sidechanneling

It looks like this sort of thing would be supported but I'm not sure if TypeDI supports that? or if stage 3 are supported at all?

export class MyService {
  @Inject(APP_CONFIG) private appConfig: AppConfig;

  constructor() {...}
}

Was hoping to use esbuild to speed up build times but constantly running into new walls and the information is so sparse on the subject of modules, decorators etc. This is the frustrating thing when relying on specs that can change... we're stuck in the transition period where I don't really know what's happening, what's working, what's supported or how.

It would be great if typedi could add a notice explaining if it depends on stage 2

from typedi.

ash2048 avatar ash2048 commented on June 1, 2024 1

typedi 0.8.0, typescript 4.7.4 + esbuild works ok for me on a project.

There are many breaking changes in 0.9.0 - https://github.com/typestack/typedi/blob/develop/CHANGELOG.md#090---20210110

from typedi.

semiautomatixfu avatar semiautomatixfu commented on June 1, 2024

And this is why we've switched most of our project to alternative DI libraries.

from typedi.

marko-hologram avatar marko-hologram commented on June 1, 2024

And this is why we've switched most of our project to alternative DI libraries.

What are those alternatives? I'm looking for a good DI library for JS/TS, but most seem to be unmaintained at this point.

from typedi.

freshgum-bubbles avatar freshgum-bubbles commented on June 1, 2024

And this is why we've switched most of our project to alternative DI libraries.

What are those alternatives? I'm looking for a good DI library for JS/TS, but most seem to be unmaintained at this point.

Well, after being a bit miffed about TypeDI, I ended up making a fork: https://github.com/freshgum-bubbles/typedi. I'd say it's pretty feature complete. The API is still technically in beta stage, but it's just a matter of ironing out the interface and adding more features on top of Typestack's TypeDI. It's feature-complete, of course, and I've written up a documentation site for it too: https://typedi.js.org/

from typedi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.