From 333539569cda1cfca949077b2d5d5f04577a6688 Mon Sep 17 00:00:00 2001 From: Robert Soriano Date: Sun, 12 Jun 2022 23:16:01 -0700 Subject: [PATCH] refactor: lint --- src/runtime/api.ts | 8 ++++---- src/runtime/client.ts | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/runtime/api.ts b/src/runtime/api.ts index 6c1a51d..08cfb3b 100644 --- a/src/runtime/api.ts +++ b/src/runtime/api.ts @@ -56,12 +56,12 @@ export function createTRPCHandler({ res, } = event - const $url = createURL(req.url) + const $url = createURL(req.url!) const httpResponse = await resolveHTTPResponse({ router, req: { - method: req.method, + method: req.method!, headers: req.headers, body: isMethod(event, 'GET') ? null : await useBody(event), query: $url.searchParams, @@ -81,8 +81,8 @@ export function createTRPCHandler({ res.statusCode = status - Object.keys(headers).forEach((key) => { - res.setHeader(key, headers[key]) + headers && Object.keys(headers).forEach((key) => { + res.setHeader(key, headers[key]!) }) return body diff --git a/src/runtime/client.ts b/src/runtime/client.ts index 6d6f5ec..38348a9 100644 --- a/src/runtime/client.ts +++ b/src/runtime/client.ts @@ -31,14 +31,12 @@ export type TError = TRPCClientErrorLike export type TQueryValues = inferProcedures - - /** * Calculates the key used for `useAsyncData` call * @param pathAndInput */ export function getQueryKey< - TPath extends keyof TQueryValues & string + TPath extends keyof TQueryValues & string, >(pathAndInput: [path: TPath, ...args: inferHandlerInput]) { return `${pathAndInput[0]}-${objectHash(pathAndInput[1] ? JSON.stringify(pathAndInput[1]) : '')}` }