Skip to content

Commit

Permalink
bugfix(@nestjs/common) add missing forward reference typing
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed May 7, 2018
1 parent 72aad1d commit 0fcdf4e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export {
ArgumentsHost,
INestExpressApplication,
INestFastifyApplication,
ForwardReference,
} from './interfaces';
export * from './interceptors';
export * from './services/logger.service';
Expand Down
3 changes: 2 additions & 1 deletion packages/common/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ export * from './features/arguments-host.interface';
export * from './nest-express-application.interface';
export * from './nest-fastify-application.interface';
export * from './modules/provider.interface';
export * from './type.interface';
export * from './type.interface';
export * from './modules/forward-reference.interface';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface ForwardReference<T = any> {
forwardRef: T;
}
3 changes: 2 additions & 1 deletion packages/common/interfaces/modules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export * from './module-metadata.interface';
export * from './nest-module.interface';
export * from './on-init.interface';
export * from './dynamic-module.interface';
export * from './provider.interface';
export * from './provider.interface';
export * from './forward-reference.interface';
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import { Controller } from '../controllers/controller.interface';
import { DynamicModule } from './dynamic-module.interface';
import { Type } from '../type.interface';
import { Provider } from './provider.interface';
import { ForwardReference } from './forward-reference.interface';

export interface ModuleMetadata {
imports?: Array<Type<any> | DynamicModule | any[]>;
imports?: Array<Type<any> | DynamicModule | ForwardReference>;
controllers?: Type<any>[];
providers?: Provider[];
exports?: Array<DynamicModule | string | Provider | any[]>;
exports?: Array<DynamicModule | string | Provider | ForwardReference>;
/** @deprecated */
modules?: Array<Type<any> | DynamicModule | any[]>;
modules?: Array<Type<any> | DynamicModule | ForwardReference>;
/** @deprecated */
components?: Provider[];
}
6 changes: 5 additions & 1 deletion packages/common/utils/forward-ref.util.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
export const forwardRef = (fn: () => any) => ({ forwardRef: fn });
import { ForwardReference } from '../interfaces/modules/forward-reference.interface';

export const forwardRef = (fn: () => any): ForwardReference => ({
forwardRef: fn,
});

0 comments on commit 0fcdf4e

Please sign in to comment.