From 09f606e625b14a03e91f099d231f4a137e4f7d2b Mon Sep 17 00:00:00 2001 From: Victor Boucher Date: Thu, 28 Dec 2023 11:00:06 +0100 Subject: [PATCH] fix: adjust SecondParameter utility type --- 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 c354097b3..32689aaaa 100644 --- a/packages/query/src/index.ts +++ b/packages/query/src/index.ts @@ -1474,13 +1474,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 9d47de3ca..e37640de5 100644 --- a/packages/swr/src/index.ts +++ b/packages/swr/src/index.ts @@ -392,13 +392,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` : '' }`;