From 848bbe35828468562b7330b11ea677afef3850e7 Mon Sep 17 00:00:00 2001 From: Victor Boucher Date: Sun, 14 Jan 2024 04:36:36 +0100 Subject: [PATCH] fix: adjust SecondParameter utility type (#1125) --- packages/axios/src/index.ts | 8 +------- packages/query/src/index.ts | 8 +------- packages/swr/src/index.ts | 8 +------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/packages/axios/src/index.ts b/packages/axios/src/index.ts index 5582d13b7..7c43d1a95 100644 --- a/packages/axios/src/index.ts +++ b/packages/axios/src/index.ts @@ -199,13 +199,7 @@ export const generateAxiosHeader: ClientHeaderBuilder = ({ }) => ` ${ isRequestOptions && isMutator - ? `// eslint-disable-next-line - type SecondParameter any> = T extends ( - config: any, - args: infer P, -) => any - ? P - : never;\n\n` + ? `type SecondParameter any> = Parameters[1];\n\n` : '' } ${!noFunction ? `export const ${title} = () => {\n` : ''}`; diff --git a/packages/query/src/index.ts b/packages/query/src/index.ts index fa655c88c..1c7b74e1f 100644 --- a/packages/query/src/index.ts +++ b/packages/query/src/index.ts @@ -1480,13 +1480,7 @@ export const generateQueryHeader: ClientHeaderBuilder = ({ } ${ isRequestOptions && isMutator - ? `// eslint-disable-next-line - type SecondParameter any> = T extends ( - config: any, - args: infer P, -) => any - ? P - : never;\n\n` + ? `type SecondParameter any> = Parameters[1];\n\n` : '' } `; diff --git a/packages/swr/src/index.ts b/packages/swr/src/index.ts index 4e02114fc..13005f15d 100644 --- a/packages/swr/src/index.ts +++ b/packages/swr/src/index.ts @@ -735,13 +735,7 @@ export const generateSwrHeader: ClientHeaderBuilder = ({ } ${ isRequestOptions && isMutator - ? `// eslint-disable-next-line - type SecondParameter any> = T extends ( - config: any, - args: infer P, -) => any - ? P - : never;\n\n` + ? `type SecondParameter any> = Parameters[1];\n\n` : '' }`;