add type check in cloneHook

This commit is contained in:
Huli
2024-10-16 12:37:38 +08:00
parent 55b86f0335
commit 9e4a163c63

View File

@@ -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 }
}