wessberg / DI-compiler

A Custom Transformer for Typescript that enables compile-time Dependency Injection
MIT License
80 stars 7 forks source link

is it possible to use with babel/preset-typescript ? #9

Closed vladmelnikov closed 3 years ago

vladmelnikov commented 3 years ago

is it possible to use with babel/preset-typescript ?

wessberg commented 3 years ago

No, because babel/preset-typescript is strictly performing syntax transformations and has no type awareness or knowledge of the internal structure of your program. That is why it has these caveats. But that is also the primary reason why it is fast. DI-Compiler requires a type checker such that it can trace symbols back to a DIContainer, and for that a proper TypeScript program is needed.