Skip to content

Conversation

at7211
Copy link

@at7211 at7211 commented Sep 2, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe: enhance error messages

What is the current behavior?

Use import type for injectable services and receive a generic, misleading error:

Nest can't resolve dependencies of the ResourceController (ResourceService, ?).
Please make sure that the argument Object at index [1] is available in the ResourceModule context.

Potential solutions:
- Is ResourceModule a valid NestJS module?
- If Object is a provider, is it part of the current ResourceModule?
...

This error leads developers to spend times debugging module configurations, checking imports/exports, when the actual issue is simply using import type instead of import. The word "Object" provides no useful information about what went wrong.

Issue Number: #15583

What is the new behavior?

Modify the error message for import type issues
Screenshot 2025-09-02 at 6 56 06 PM

Add doc link in common error message
Screenshot 2025-09-02 at 6 59 56 PM

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@coveralls
Copy link

coveralls commented Sep 2, 2025

Pull Request Test Coverage Report for Build 964fbd0f-edcd-4af0-ab5d-94995d253fa8

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.734%

Totals Coverage Status
Change from base Build 7b4a73ca-16c1-4971-b090-cccb521e04c7: 0.0%
Covered Lines: 7270
Relevant Lines: 8193

💛 - Coveralls

@at7211 at7211 force-pushed the feat/enhance-dependency-error-messages branch from d9013e2 to ae5e68d Compare September 2, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants