-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
55 lines (49 loc) · 1.15 KB
/
index.d.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import type { Session } from "next-auth";
import type { NextApiResponse, NextApiHandler } from "next";
import type {
PrismaClient,
PlatformQueryConfig,
Connection,
} from "@prisma/client";
type ResponseLocals = {
locals: {
platform: Platform;
query: PlatformQuery;
config: any;
connection: Connection?;
services: any;
templates: any;
};
};
declare global {
namespace globalThis {
var prisma: PrismaClient;
}
}
// widen Session type to include user id
declare module "next-auth" {
interface Session {
user: {
name: string;
id: string;
email: string;
image: string;
};
}
}
// change unstable_getServerSession returning type
declare module "next-auth/next" {
export function getServerSession(
...args: Parameters<typeof getServerSession>
): Promise<Session | null>;
}
// wide NexApiResponse for res.locals
// but don't override, wide
declare module "next" {
type NextApiHandler<T = any> = (
req: NextApiRequest,
res: NextApiResponse<T> & ResponseLocals
) => unknown | Promise<unknown>;
type NextApiResponse = NextApiResponse & ResponseLocals;
}
declare module "http" {}