Skip to content

Commit a06469f

Browse files
committed
fix: typescript types
1 parent 8a646aa commit a06469f

File tree

3 files changed

+14
-40
lines changed

3 files changed

+14
-40
lines changed

instrumentation.node.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ const sdk = new NodeSDK({
3030
metricReader: new PeriodicExportingMetricReader({
3131
exporter:
3232
process.env.NODE_ENV === 'production' ?
33-
new OTLPMetricExporter() :
34-
new ConsoleMetricExporter(),
35-
}),
33+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
34+
new OTLPMetricExporter() as any :
35+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
36+
new ConsoleMetricExporter() as any,
37+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
38+
}) as any,
3639
instrumentations: [
3740
getNodeAutoInstrumentations({
3841
'@opentelemetry/instrumentation-http': {

nextjs/nextjs-routes.d.ts

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55

66
// prettier-ignore
77
declare module "nextjs-routes" {
8-
import type {
9-
GetServerSidePropsContext as NextGetServerSidePropsContext,
10-
GetServerSidePropsResult as NextGetServerSidePropsResult
11-
} from "nextjs";
12-
138
export type Route =
149
| StaticRoute<"/404">
1510
| StaticRoute<"/account/api-key">
@@ -112,33 +107,6 @@ declare module "nextjs-routes" {
112107
* route({ pathname: "/foos/[foo]", query: { foo: "bar" }}) will produce "/foos/bar".
113108
*/
114109
export declare function route(r: Route): string;
115-
116-
/**
117-
* Nearly identical to GetServerSidePropsContext from next, but further narrows
118-
* types based on nextjs-route's route data.
119-
*/
120-
export type GetServerSidePropsContext<
121-
Pathname extends Route["pathname"] = Route["pathname"],
122-
Preview extends NextGetServerSidePropsContext["previewData"] = NextGetServerSidePropsContext["previewData"]
123-
> = Omit<NextGetServerSidePropsContext, 'params' | 'query' | 'defaultLocale' | 'locale' | 'locales'> & {
124-
params: Extract<Route, { pathname: Pathname }>["query"];
125-
query: Query;
126-
defaultLocale?: undefined;
127-
locale?: Locale;
128-
locales?: undefined;
129-
};
130-
131-
/**
132-
* Nearly identical to GetServerSideProps from next, but further narrows
133-
* types based on nextjs-route's route data.
134-
*/
135-
export type GetServerSideProps<
136-
Props extends { [key: string]: any } = { [key: string]: any },
137-
Pathname extends Route["pathname"] = Route["pathname"],
138-
Preview extends NextGetServerSideProps["previewData"] = NextGetServerSideProps["previewData"]
139-
> = (
140-
context: GetServerSidePropsContext<Pathname, Preview>
141-
) => Promise<NextGetServerSidePropsResult<Props>>
142110
}
143111

144112
// prettier-ignore
@@ -153,12 +121,13 @@ declare module "next/link" {
153121
} from "react";
154122
export * from "next/dist/client/link";
155123

124+
type Query = { query?: { [key: string]: string | string[] | undefined } };
156125
type StaticRoute = Exclude<Route, { query: any }>["pathname"];
157126

158127
export interface LinkProps
159128
extends Omit<NextLinkProps, "href" | "locale">,
160129
AnchorHTMLAttributes<HTMLAnchorElement> {
161-
href: Route | StaticRoute | Omit<Route, "pathname">
130+
href: Route | StaticRoute | Query;
162131
locale?: false;
163132
}
164133

@@ -186,6 +155,7 @@ declare module "next/router" {
186155

187156
type NextTransitionOptions = NonNullable<Parameters<Router["push"]>[2]>;
188157
type StaticRoute = Exclude<Route, { query: any }>["pathname"];
158+
type Query = { query?: { [key: string]: string | string[] | undefined } };
189159

190160
interface TransitionOptions extends Omit<NextTransitionOptions, "locale"> {
191161
locale?: false;
@@ -207,12 +177,12 @@ declare module "next/router" {
207177
locale?: Locale;
208178
locales?: undefined;
209179
push(
210-
url: Route | StaticRoute | Omit<Route, "pathname">,
180+
url: Route | StaticRoute | Query,
211181
as?: string,
212182
options?: TransitionOptions
213183
): Promise<boolean>;
214184
replace(
215-
url: Route | StaticRoute | Omit<Route, "pathname">,
185+
url: Route | StaticRoute | Query,
216186
as?: string,
217187
options?: TransitionOptions
218188
): Promise<boolean>;

tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
"baseUrl": ".",
1919
"types": ["node", "jest"],
2020
},
21-
"include": ["next-env.d.ts", "**/*.ts", "**/*.node.ts", "**/*.tsx", "**/*.pw.tsx", "decs.d.ts", "global.d.ts"],
21+
"include": ["next-env.d.ts", "**/*.ts", "**/*.node.ts", "**/*.tsx", "decs.d.ts", "global.d.ts"],
2222
"exclude": [
2323
"node_modules",
2424
"node_modules_linux",
2525
"./deploy/tools/envs-validator",
2626
"./deploy/tools/favicon-generator",
2727
"./toolkit/package",
2828
"./toolkit/theme/design-system/build",
29-
"./toolkit/theme/design-system/dist"
29+
"./toolkit/theme/design-system/dist",
30+
"**/*.pw.tsx"
3031
],
3132
}

0 commit comments

Comments
 (0)