Skip to content

Commit

Permalink
add type check in cloneHook
Browse files Browse the repository at this point in the history
  • Loading branch information
Huliiiiii committed Oct 16, 2024
1 parent 55b86f0 commit 9e4a163
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export const generateOperationId = (method: string, paths: string) => {

const cloneHook = <T>(hook: T) => {
if (!hook) return

if (typeof hook === 'string') return hook
if (Array.isArray(hook)) return [...hook]
return { ...hook }
}

Expand Down

0 comments on commit 9e4a163

Please sign in to comment.