Skip to content

Commit 20ecfb9

Browse files
committed
fix(lint): remove linting errors
1 parent e67935d commit 20ecfb9

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

packages/core/src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,30 +127,30 @@ export function createFlytrapLogger<T>({
127127
getContext,
128128
addContext,
129129
flush,
130-
catchUncaughtAction<T extends (...args: any[]) => Promise<any>>(
130+
catchUncaughtAction<T extends (...args: unknown[]) => Promise<unknown>>(
131131
fn: T,
132132
options?: Partial<z.infer<typeof baseLogSchema>>
133133
) {
134-
// @ts-expect-error
134+
// @ts-expect-error: `addContext` is incompatible due to `T`
135135
return catchUncaughtAction(fn, addContext, flush, options)
136136
},
137137
catchUncaughtRoute<T extends { params: Record<string, unknown> }>(
138138
fn: (request: Request, context: T) => Promise<Response> | Response,
139139
options?: Partial<z.infer<typeof baseLogSchema>>
140140
) {
141-
// @ts-expect-error
141+
// @ts-expect-error: `addContext` is incompatible due to `T`
142142
return catchUncaughtRoute(fn, addContext, flush, options)
143143
},
144144
response(body: BodyInit, opts: ResponseInit = {}) {
145-
// @ts-expect-error
145+
// @ts-expect-error: `addContext` is incompatible due to `T`
146146
return response(body, opts, addContext)
147147
},
148-
json(data: any, opts: ResponseInit = {}) {
149-
// @ts-expect-error
148+
json(data: unknown, opts: ResponseInit = {}) {
149+
// @ts-expect-error: `addContext` is incompatible due to `T`
150150
return json(data, opts, addContext)
151151
},
152152
redirect(url: string | URL, status?: number) {
153-
// @ts-expect-error
153+
// @ts-expect-error: `addContext` is incompatible due to `T`
154154
return redirect(url, status, addContext)
155155
},
156156
}

packages/core/src/request-utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function response(
1818
}
1919

2020
export function json(
21-
data: any,
21+
data: unknown,
2222
opts: ResponseInit = {},
2323
addContext: AddContextFn<z.infer<typeof baseLogSchema>>
2424
) {
@@ -89,7 +89,9 @@ export function catchUncaughtRoute<
8989
}
9090
}
9191

92-
export function catchUncaughtAction<T extends (...args: any[]) => Promise<any>>(
92+
export function catchUncaughtAction<
93+
T extends (...args: unknown[]) => Promise<unknown>,
94+
>(
9395
fn: T,
9496
addContext: AddContextFn<z.infer<typeof baseLogSchema>>,
9597
flush: FlushFn,

packages/core/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function headersToRecord(headers: Headers) {
1515
return headersRecord
1616
}
1717

18-
export function buildJsonLog<T extends {}>(logs: Array<Partial<T>>) {
18+
export function buildJsonLog<T extends object>(logs: Array<Partial<T>>) {
1919
const logsObj: Record<string, unknown> = {}
2020
for (let i = 0; i < logs.length; i++) {
2121
Object.entries(logs[i]).forEach(([key, value]) => {

0 commit comments

Comments
 (0)