diff --git a/src/types.ts b/src/types.ts index a81858de..3a539911 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1927,9 +1927,11 @@ type MergeTypedResponse = T extends Promise ////// ///// //////////////////////////////////////// +export type FormValue = string | File + export type ValidationTargets = { json: any - form: Record + form: Record query: Record param: Record | Record header: Record diff --git a/src/validator/validator.test.ts b/src/validator/validator.test.ts index 12028b93..2044a489 100644 --- a/src/validator/validator.test.ts +++ b/src/validator/validator.test.ts @@ -3,7 +3,13 @@ import type { ZodSchema } from 'zod' import { z } from 'zod' import { Hono } from '../hono' import { HTTPException } from '../http-exception' -import type { ErrorHandler, ExtractSchema, MiddlewareHandler, ValidationTargets } from '../types' +import type { + ErrorHandler, + ExtractSchema, + FormValue, + MiddlewareHandler, + ValidationTargets, +} from '../types' import type { StatusCode } from '../utils/http-status' import type { Equal, Expect } from '../utils/types' import type { ValidationFunction } from './validator' @@ -743,7 +749,7 @@ it('With path parameters', () => { $put: { input: { form: { - title: string | File + title: FormValue | FormValue[] } } & { param: { @@ -789,7 +795,7 @@ it('`on`', () => { $purge: { input: { form: { - tag: string | File + tag: FormValue | FormValue[] } } & { query: {