Skip to content
Myr

Merge branch 'main' into next

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yusuke Wada · committed by Yusuke Wada · parents 9a6e52d, 2d01359 · Browse files · 6 files+39 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+39 added−10 removed

  • tests:+25 added−3 removed
  • other:+14 added−7 removed

6 files+39 added−10 removed

modified:src/client/client.ts+2 added-2 removed
1import type { Hono } from '../hono'2import type { ValidationTargets } from '../types'2import type { FormValue, ValidationTargets } from '../types'3import { serialize } from '../utils/cookie'4import type { UnionToIntersection } from '../utils/types'5import type { Callback, Client, ClientRequestOptions } from './types'6import {
34 unmodified lines
41 this.url = url42 this.method = method43 }44 fetch = async (45 args?: ValidationTargets & {45 args?: ValidationTargets<FormValue> & {46 param?: Record<string, string>47 },48 opt?: ClientRequestOptions49 ) => {
151 unmodified lines
modified:src/helper/factory/index.ts+5 added-1 removed
239 unmodified lines
240export const createFactory = <E extends Env = any, P extends string = any>(init?: {241 initApp?: InitApp<E>242}): Factory<E, P> => new Factory<E, P>(init)243244export const createMiddleware = <E extends Env = any, P extends string = any, I extends Input = {}>(244export const createMiddleware = <245 E extends Env = any,246 P extends string = string,247 I extends Input = {}248>(249 middleware: MiddlewareHandler<E, P, I>250): MiddlewareHandler<E, P, I> => createFactory<E, P>().createMiddleware<I>(middleware)
modified:src/jsx/intrinsic-elements.ts+1 added-1 removed
616 unmodified lines
617 align?: 'left' | 'center' | 'right' | 'justify' | 'char' | undefined618 colspan?: number | undefined619 headers?: string | undefined620 rowspan?: number | undefined621 scope?: string | undefined621 scope?: 'row' | 'col' | 'rowgroup' | 'colgroup' | string | undefined622 abbr?: string | undefined623 }624625 interface TimeHTMLAttributes extends HTMLAttributes {
142 unmodified lines
modified:src/validator/validator.test.ts+10 added-3 removed
1 unmodified line
2import type { ZodSchema } from 'zod'3import { z } from 'zod'4import { Hono } from '../hono'5import { HTTPException } from '../http-exception'6import type { ErrorHandler, ExtractSchema, MiddlewareHandler, ValidationTargets } from '../types'6import type {7 ErrorHandler,8 ExtractSchema,9 FormValue,10 MiddlewareHandler,11 ParsedFormValue,12 ValidationTargets,13} from '../types'14import type { StatusCode } from '../utils/http-status'15import type { Equal, Expect } from '../utils/types'16import type { ValidationFunction } from './validator'17import { validator } from './validator'
731 unmodified lines
749 '/posts/:id': {750 $put: {751 input: {752 form: {746 title: string | File753 title: ParsedFormValue | ParsedFormValue[]754 }755 } & {756 param: {757 id: string
37 unmodified lines
795 '/purge': {796 $purge: {797 input: {798 form: {792 tag: string | File799 tag: ParsedFormValue | ParsedFormValue[]800 }801 } & {802 query: {803 q: string | string[]
272 unmodified lines
modified:src/types.test.ts+15 added
2223 unmodified lines
2224 return c.json(0)2225 })2226 })2227})22282229// https://github.com/honojs/hono/issues/31222230describe('Returning type from `app.use(path, mw)`', () => {2231 const mw = createMiddleware(async (c, next) => {2232 await next()2233 })2234 it('Should not mark `*` as never', () => {2235 const app = new Hono().use('*', mw)2236 type Actual = ExtractSchema<typeof app>2237 type Expected = {2238 '*': {}2239 }2240 type verify = Expect<Equal<Expected, Actual>>2241 })2242})
modified:src/types.ts+6 added-3 removed
1802 unmodified lines
1803 }1804}18051806type ChangePathOfSchema<S extends Schema, Path extends string> = keyof S extends never1807 ? { [K in Path]: never }1807 ? { [K in Path]: {} }1808 : { [K in keyof S as Path]: S[K] }18091810export type Endpoint = {1811 input: Partial<ValidationTargets>
114 unmodified lines
1926////// ValidationTargets /////1927////// /////1928////////////////////////////////////////19291930export type ValidationTargets = {1930export type FormValue = string | Blob1931export type ParsedFormValue = string | File19321933export type ValidationTargets<T extends FormValue = ParsedFormValue> = {1934 json: any1932 form: Record<string, string | File>1935 form: Record<string, T | T[]>1936 query: Record<string, string | string[]>1937 param: Record<string, string> | Record<string, string | undefined>1938 header: Record<string, string>1939 cookie: Record<string, string>
70 unmodified lines