-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.d.ts
More file actions
28 lines (22 loc) · 779 Bytes
/
types.d.ts
File metadata and controls
28 lines (22 loc) · 779 Bytes
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
28
import fastify from 'fastify';
interface PointOfViewRouteSpecificOptions {
layout?: string;
}
export type PointOfViewProperty<
K extends string = 'view',
T extends { [key: string]: any } = { [key: string]: any },
R = Promise<string>,
> = Record<K, (page: string, data: T, opts?: PointOfViewRouteSpecificOptions) => R>;
declare module 'fastify' {
export interface FastifyRequest {
user_id: string;
auth_guard_type: 'inner' | 'api';
}
interface RouteSpecificOptions extends PointOfViewRouteSpecificOptions {}
interface FastifyReply extends PointOfViewProperty<'admin' | 'themes', object, FastifyReply> {
view: never;
}
interface FastifyInstance extends PointOfViewProperty<'admin' | 'themes', object, Promise<string>> {
view: never;
}
}