Skip to content

Commit

Permalink
feat(common): disallow option inject on class/value providers types
Browse files Browse the repository at this point in the history
  • Loading branch information
micalevisk committed Mar 25, 2022
1 parent 061a19e commit eb33fe5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/common/interfaces/modules/provider.interface.ts
Expand Up @@ -46,6 +46,12 @@ export interface ClassProvider<T = any> {
* Optional enum defining lifetime of the provider that is injected.
*/
scope?: Scope;
/**
* This option is only available on factory providers!
*
* @see [Use factory](https://docs.nestjs.com/fundamentals/custom-providers#factory-providers-usefactory)
*/
inject?: never;
}

/**
Expand All @@ -72,6 +78,12 @@ export interface ValueProvider<T = any> {
* Instance of a provider to be injected.
*/
useValue: T;
/**
* This option is only available on factory providers!
*
* @see [Use factory](https://docs.nestjs.com/fundamentals/custom-providers#factory-providers-usefactory)
*/
inject?: never;
}

/**
Expand Down

0 comments on commit eb33fe5

Please sign in to comment.