@nestjs/typeorm
Version:
Nest - modern, fast, powerful node.js web framework (@typeorm)
26 lines (25 loc) • 1.07 kB
TypeScript
/**
* Runtime compatibility helpers for accessing TypeORM APIs that were
* removed in TypeORM v1.0.0 (notably `Connection` and `AbstractRepository`).
*
* Importing these symbols statically from `typeorm` would produce
* TypeScript errors for consumers on TypeORM v1 when `skipLibCheck` is
* disabled, and would cause runtime crashes inside `@nestjs/typeorm`
* because the values resolve to `undefined`.
*
* Resolving them lazily via `require()` keeps the package working on
* both TypeORM 0.3.x (where the symbols still exist) and 1.0.x
* (where they have been removed) without forcing a type dependency.
*/
type OptionalCtor = (new (...args: any[]) => any) | undefined;
/**
* The TypeORM `Connection` class (removed in TypeORM v1.0.0, replaced by
* `DataSource` since 0.3.0). Resolves to `undefined` on TypeORM v1+.
*/
export declare const Connection: OptionalCtor;
/**
* The TypeORM `AbstractRepository` class (removed in TypeORM v1.0.0).
* Resolves to `undefined` on TypeORM v1+.
*/
export declare const AbstractRepository: OptionalCtor;
export {};