Skip to content

Commit 624d3ec

Browse files
committed
feat: type mapping
1 parent 8736c9d commit 624d3ec

File tree

2 files changed

+50
-18
lines changed

2 files changed

+50
-18
lines changed

src/typings/custom-env.d.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { NextApiRequest, NextApiResponse } from "next";
2+
import { Server } from "socket.io";
3+
4+
import io from "socket.io-client";
5+
6+
declare module "next" {
7+
export interface Request extends NextApiRequest {
8+
user: {
9+
id: string;
10+
name: string;
11+
};
12+
}
13+
14+
export interface Response extends NextApiResponse {
15+
socket: {
16+
server: io;
17+
};
18+
}
19+
}

tsconfig.json

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
{
2-
"compilerOptions": {
3-
"target": "es5",
4-
"lib": ["dom", "dom.iterable", "esnext"],
5-
"allowJs": true,
6-
"skipLibCheck": true,
7-
"strict": true,
8-
"forceConsistentCasingInFileNames": true,
9-
"noEmit": true,
10-
"esModuleInterop": true,
11-
"module": "esnext",
12-
"moduleResolution": "node",
13-
"resolveJsonModule": true,
14-
"isolatedModules": true,
15-
"jsx": "preserve",
16-
"incremental": true
17-
},
18-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
19-
"exclude": ["node_modules"]
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": [
5+
"dom",
6+
"dom.iterable",
7+
"esnext"
8+
],
9+
"allowJs": true,
10+
"skipLibCheck": true,
11+
"strict": true,
12+
"forceConsistentCasingInFileNames": true,
13+
"noEmit": true,
14+
"esModuleInterop": true,
15+
"module": "esnext",
16+
"moduleResolution": "node",
17+
"resolveJsonModule": true,
18+
"isolatedModules": true,
19+
"jsx": "preserve",
20+
"incremental": true,
21+
"baseUrl": ".",
22+
"paths": {}
23+
},
24+
"include": [
25+
"next-env.d.ts",
26+
"./src/typings",
27+
"**/*.ts",
28+
"**/*.tsx",
29+
],
30+
"exclude": [
31+
"node_modules"
32+
]
2033
}

0 commit comments

Comments
 (0)