From 9e4a163c6367c121fb97498bd184c067af4d881b Mon Sep 17 00:00:00 2001 From: Huli <134658521+Huliiiiii@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:37:38 +0800 Subject: [PATCH] add type check in cloneHook --- src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index 62c182a..91e3155 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -106,7 +106,8 @@ export const generateOperationId = (method: string, paths: string) => { const cloneHook = (hook: T) => { if (!hook) return - + if (typeof hook === 'string') return hook + if (Array.isArray(hook)) return [...hook] return { ...hook } }