Proposal: make use of injection-js
See original GitHub issueI’m submitting a…
[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
- At this time we cannot use InjectionToken, an Angular-like feature, and have to manually type string to
@Inject
(I could not use const variable too, see my comment )
UPDATE: I have figured out this is an limitation of Nest when you could not declare token in the same file with Module. That’s why I propose that we should use injection-js instead current DI system.
- Lack of type checking for components array declaration in
Module
. In Angular when we try to declare providers in@NgModule
, we have nice type checking and auto completion. But we we don’t have that nice feature in Nestjs@Module
components declaration.
Expected behavior
We should make use of injectable-js, a light weight and well tested DI framework extracted from Angular core v4.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
With that we can support InjectionToken for creating unique token across application as well as reuse code across server and client side. (Token in Angular use InjectionToken)
Environment
Nest version: 4.6.0
For Tooling issues:
- Node version: 8.9.4
- Platform: Mac
Others:
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:18 (9 by maintainers)
Top Results From Across the Web
Proposal to allow drug injection sites spurs debate
Delaware County Sheriff Craig DuMond said allowing drug use at the sites would only facilitate addiction to potentially deadly narcotics. “We ...
Read more >California debates opening supervised sites for people to use ...
A man uses a safe injection site in New York City in January. A bill in California would allow pilot sites in San...
Read more >A Proposal for Botulinum Toxin Type A Injection Into ... - NCBI
Botulinum toxin type-A (BTX-A) injection for treating chronic migraine (CM) has developed into a new technique covering distinct injection ...
Read more >Denver heroin users could use supervised injection site if ...
Denver heroin users could use supervised injection site if proposal passes multiple hurdles. Legislative committee gives initial approval as ...
Read more >Governor Newsom Vetoes Bill for Drug-Injection Sites in ...
The proposal would have made the nation's most populous state home to its broadest experiment with supervised injection sites, where people ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @sandangel That sounds strange to me, Nest Is using
Reflection
under the hood , maybe imo it is a limitation of the libraryreflect-metadata
or Typescript idk, butAngular
orinjection-js
using another approach but it is the same concept. due to some limitation on the browser, and you knowAngular
SHOULD have support for massive number of browsers. actually, about month ago, I was playing withInjection-js
and decided to create a simple core framework for learning purpose, something likeNest
, but instead of creating my own Depancy Injection Engine, I prefered to go with Angular’s, here is a minimal repo: Core 101. I learned a lot of techniques and how Angular orNest
works. anyway, I think there is no reason to change theNest DI Engine
with Angular’s one. Hope this will help you.This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.