Skip to content

Conversation

@micalevisk
Copy link
Member

@micalevisk micalevisk commented Jun 22, 2024

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:

What is the current behavior?

the following code triggers the error because of the forwardRef on exports array

import { Module, forwardRef } from '@nestjs/common';

@Module({})
export class FooModule {}

@Module({
  imports: [
    forwardRef(() => FooModule),
  ],
  exports: [forwardRef(() => FooModule)],
})
export class AppModule {}

image

Which breaks the ConditionModule from @nestjs/config when we use a forward reference.

Do note that the same error happens when we supply a promise to exports:

image

but I didn't address this error in this PR because I'm not sure about the error handling for rejected promises and about the right place to resolve such promise.

What is the new behavior?

we can now use forwardRef on exports, as its type definition tell us so.

I also made a tiny change to the issue template of bug reports. It will look like this:

image

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

I guess such usage was supposed to be supported since this commit: 0fcdf4e

@coveralls
Copy link

coveralls commented Jun 22, 2024

Pull Request Test Coverage Report for Build ae758b3c-61b4-4091-ac37-30a901dce476

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 92.208%

Totals Coverage Status
Change from base Build 0f9b0016-1853-4775-8f4d-a4d89fc35f0f: 0.001%
Covered Lines: 6745
Relevant Lines: 7315

💛 - Coveralls

@kamilmysliwiec
Copy link
Member

lgtm

@micalevisk micalevisk deleted the fix/forwardref-on-exports branch July 1, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants