diff --git a/src/utils.ts b/src/utils.ts index 6d72107..19f5170 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -160,9 +160,13 @@ export const registerSchemaPath = ({ return x case 'object': - if (x && typeof x.fn !== 'string') return + if ( + x && + typeof (x as { fn: string | Function })?.fn !== 'string' + ) + return - switch (x.fn) { + switch ((x as { fn: string | Function })?.fn) { case 'json': case 'application/json': return 'application/json' @@ -185,7 +189,7 @@ export const registerSchemaPath = ({ } } }) - .filter((x) => !!x) + .filter((x) => x !== undefined) if (!contentType || contentType.length === 0) contentType = ['application/json', 'multipart/form-data', 'text/plain']