forked from serdnam/fastify-mikro-orm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
27 lines (22 loc) · 738 Bytes
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* eslint-disable no-unused-vars */
import { MikroORM, Options } from '@mikro-orm/core'
export declare namespace fastifyMikroOrm {
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#recursive-conditional-types
type Awaited<T> = T extends PromiseLike<infer U> ? Awaited<U> : T;
type FastifyMikroOrmOptions = {
forkOnRequest?: boolean
}
type MikroORMPluginOptions = Options & FastifyMikroOrmOptions;
}
declare module 'fastify' {
interface FastifyInstance {
mikroORM: {
orm: fastifyMikroOrm.Awaited<ReturnType<(typeof MikroORM)['init']>>
}
}
interface FastifyRequest {
mikroORM: {
orm: fastifyMikroOrm.Awaited<ReturnType<(typeof MikroORM)['init']>>
}
}
}