Skip to content

Commit 3b88b94

Browse files
authored
Merge pull request #158 from disintegrator/ts-esinterop
fix: switch wildcard imports for more specific named imports [typescript]
2 parents f713c1e + 7f7521b commit 3b88b94

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

typings/next-routes.d.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import http from "http";
2-
import next from "next";
1+
import { IncomingMessage, ServerResponse } from "http";
2+
import { Server } from "next";
33
import { ComponentType } from "react";
44
import { LinkState } from "next/link";
55
import { SingletonRouter, EventChangeOptions } from "next/router";
66

77
export type HTTPHandler = (
8-
request: http.IncomingMessage,
9-
response: http.ServerResponse
8+
request: IncomingMessage,
9+
response: ServerResponse
1010
) => void;
1111

1212
export type RouteParams = {
@@ -36,7 +36,7 @@ export interface Router extends SingletonRouter {
3636
}
3737

3838
export interface Registry {
39-
getRequestHandler(app: next.Server, custom?: HTTPHandler): HTTPHandler;
39+
getRequestHandler(app: Server, custom?: HTTPHandler): HTTPHandler;
4040
add(name: string, pattern?: string, page?: string): this;
4141
add(pattern: string, page: string): this;
4242
add(options: { name: string; pattern?: string; page?: string }): this;
@@ -45,7 +45,7 @@ export interface Registry {
4545
}
4646

4747
export default class Routes implements Registry {
48-
getRequestHandler(app: next.Server, custom?: HTTPHandler): HTTPHandler;
48+
getRequestHandler(app: Server, custom?: HTTPHandler): HTTPHandler;
4949
add(name: string, pattern?: string, page?: string): this;
5050
add(pattern: string, page: string): this;
5151
add(options: { name: string; pattern?: string; page?: string }): this;

typings/tests/basic.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import http from "http";
2-
import next from "next";
1+
import * as http from "http";
2+
import * as next from "next";
33
import Routes from "../..";
44

55
const routes = new Routes();

typings/tests/tsconfig.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,11 @@
44
"module": "esnext",
55
"noEmit": true,
66
"jsx": "react",
7-
87
"strict": true,
9-
108
"noUnusedLocals": true,
119
"noUnusedParameters": true,
1210
"noImplicitReturns": true,
1311
"noFallthroughCasesInSwitch": true,
14-
15-
"moduleResolution": "node",
16-
"allowSyntheticDefaultImports": true,
17-
"esModuleInterop": true
12+
"moduleResolution": "node"
1813
}
1914
}

0 commit comments

Comments
 (0)