diff --git a/src/mikro-orm.common.ts b/src/mikro-orm.common.ts index 8fe7901..0e39afe 100644 --- a/src/mikro-orm.common.ts +++ b/src/mikro-orm.common.ts @@ -1,6 +1,6 @@ -import type { EntityName } from '@mikro-orm/core'; import { MikroORM, Utils } from '@mikro-orm/core'; import { Inject, Logger } from '@nestjs/common'; +import type { EntityName } from './typings'; export const MIKRO_ORM_MODULE_OPTIONS = Symbol('mikro-orm-module-options'); export const CONTEXT_NAMES: string[] = []; diff --git a/src/mikro-orm.entities.storage.ts b/src/mikro-orm.entities.storage.ts index 1c6b5d3..7883c78 100644 --- a/src/mikro-orm.entities.storage.ts +++ b/src/mikro-orm.entities.storage.ts @@ -1,4 +1,5 @@ -import type { AnyEntity, EntityName } from '@mikro-orm/core'; +import type { AnyEntity } from '@mikro-orm/core'; +import type { EntityName } from './typings'; export class MikroOrmEntitiesStorage { diff --git a/src/mikro-orm.module.ts b/src/mikro-orm.module.ts index f10c245..9a3803f 100644 --- a/src/mikro-orm.module.ts +++ b/src/mikro-orm.module.ts @@ -1,4 +1,4 @@ -import type { AnyEntity, EntityName } from '@mikro-orm/core'; +import type { AnyEntity } from '@mikro-orm/core'; import { Utils } from '@mikro-orm/core'; import type { DynamicModule } from '@nestjs/common'; import { Module } from '@nestjs/common'; @@ -9,6 +9,7 @@ import type { MikroOrmModuleSyncOptions, MikroOrmMiddlewareModuleOptions, MikroOrmModuleFeatureOptions, + EntityName, } from './typings'; import { MikroOrmMiddlewareModule } from './mikro-orm-middleware.module'; import { MikroOrmEntitiesStorage } from './mikro-orm.entities.storage'; diff --git a/src/mikro-orm.providers.ts b/src/mikro-orm.providers.ts index 1b91700..52b929b 100644 --- a/src/mikro-orm.providers.ts +++ b/src/mikro-orm.providers.ts @@ -1,8 +1,8 @@ import { getEntityManagerToken, getMikroORMToken, getRepositoryToken, logger, MIKRO_ORM_MODULE_OPTIONS } from './mikro-orm.common'; -import type { AnyEntity, EntityName } from '@mikro-orm/core'; +import type { AnyEntity } from '@mikro-orm/core'; import { ConfigurationLoader, EntityManager, MetadataStorage, MikroORM } from '@mikro-orm/core'; -import type { MikroOrmModuleAsyncOptions, MikroOrmModuleOptions, MikroOrmOptionsFactory } from './typings'; +import type { MikroOrmModuleAsyncOptions, MikroOrmModuleOptions, MikroOrmOptionsFactory, EntityName } from './typings'; import type { Provider, Type } from '@nestjs/common'; import { Scope } from '@nestjs/common'; import { MikroOrmEntitiesStorage } from './mikro-orm.entities.storage'; diff --git a/src/typings.ts b/src/typings.ts index fde178f..a03d51d 100644 --- a/src/typings.ts +++ b/src/typings.ts @@ -1,4 +1,4 @@ -import type { AnyEntity, EntityName, IDatabaseDriver, Options } from '@mikro-orm/core'; +import type { AnyEntity, EntityName as CoreEntityName, EntitySchema, IDatabaseDriver, Options } from '@mikro-orm/core'; import type { MiddlewareConsumer, ModuleMetadata, Scope, Type } from '@nestjs/common'; import type { AbstractHttpAdapter } from '@nestjs/core'; @@ -44,3 +44,5 @@ export interface MikroOrmModuleAsyncOptions Promise, 'contextName'>> | Omit, 'contextName'>; inject?: any[]; } + +export declare type EntityName> = CoreEntityName | EntitySchema;