Skip to content

Commit

Permalink
fix: adjust SecondParameter utility type (#1125)
Browse files Browse the repository at this point in the history
  • Loading branch information
victorboucher authored Jan 14, 2024
1 parent 632a666 commit 848bbe3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
8 changes: 1 addition & 7 deletions packages/axios/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,7 @@ export const generateAxiosHeader: ClientHeaderBuilder = ({
}) => `
${
isRequestOptions && isMutator
? `// eslint-disable-next-line
type SecondParameter<T extends (...args: any) => any> = T extends (
config: any,
args: infer P,
) => any
? P
: never;\n\n`
? `type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];\n\n`
: ''
}
${!noFunction ? `export const ${title} = () => {\n` : ''}`;
Expand Down
8 changes: 1 addition & 7 deletions packages/query/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1480,13 +1480,7 @@ export const generateQueryHeader: ClientHeaderBuilder = ({
}
${
isRequestOptions && isMutator
? `// eslint-disable-next-line
type SecondParameter<T extends (...args: any) => any> = T extends (
config: any,
args: infer P,
) => any
? P
: never;\n\n`
? `type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];\n\n`
: ''
}
`;
Expand Down
8 changes: 1 addition & 7 deletions packages/swr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -735,13 +735,7 @@ export const generateSwrHeader: ClientHeaderBuilder = ({
}
${
isRequestOptions && isMutator
? `// eslint-disable-next-line
type SecondParameter<T extends (...args: any) => any> = T extends (
config: any,
args: infer P,
) => any
? P
: never;\n\n`
? `type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];\n\n`
: ''
}`;

Expand Down

0 comments on commit 848bbe3

Please sign in to comment.