question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

useValue bugged in latest version

See original GitHub issue

Bug Report

Current behavior

I try to write a dynamic module. Check the gist from 🙏 @evolkmann. I get a compiler error:

Returned expression type ... is not assigneable to DynamicModule

If you switch to useClass it seamlessly works. What am I doing wrong or is it a bug?

Input Code

https://gist.github.com/evolkmann/1019721d46304df3d8ff7adbca87d8ec

Expected behavior

No compiler error since this should work acc. to official docs and I assume gist worked once.

Possible Solution

It works with

{
 provide: MyLibService,
  useFactory: () => {
  return new MyLibService(type);
 },
}

But it should accept a value too…?

Environment


"@nestjs/common": "^6.7.2",
"@nestjs/core": "^6.7.2",
 
For Tooling issues:
- Node version:
"node": "10.16.2"
"npm": "6.10.3"
- Platform: Mac

Others:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
mambaxcommented, Sep 27, 2019

🎺 Turns out, rm -rf .idea does not completely invalidate all caches, weird! I also deleted caches File > Invalidate caches / Restart and now it works. Sorry everyone to bother.

1reaction
kamilmysliwieccommented, Sep 27, 2019

@angelov-todor @dboskovic just fixed in @nestjs/graphql@6.5.3. Thanks for reporting!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug of ValueProvider · Issue #2732 · nestjs/nest
Bug Report Current behavior When 'useValue' is undefined, ... Nest version: 6.5.3 For Tooling issues: - Node version: 10.15.0 - Platform: ...
Read more >
Value annotation not working in Junit test - java
Following works for me. It picks up value from the application.properties file.
Read more >
Known issues
Known issues. The following issues have been identified in version 7.2.3. To inquire about a particular bug or report a bug, please contact...
Read more >
Angular Providers: useClass, useValue, useFactory & ...
Configuring the Angular Provider. To Provide an instance of the dependency, we need to register it in the Providers metadata. In our last...
Read more >
Dependency injection in action
The useValue key lets you associate a fixed value with a DI token. Use this technique to provide runtime configuration constants such as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found