0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-24 11:07:29 +01:00

fix(types): remove slow types (#3147)

This commit is contained in:
Yusuke Wada 2024-07-16 22:53:33 +09:00 committed by GitHub
parent 20d877167c
commit c63251172c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 6 deletions

View File

@ -34,8 +34,8 @@ export const compose = <C extends ComposeContext, E extends Env = Env>(
middleware: [[Function, unknown], ParamIndexMap | Params][],
onError?: ErrorHandler<E>,
onNotFound?: NotFoundHandler<E>
) => {
return (context: C, next?: Function) => {
): ((context: C, next?: Function) => Promise<C>) => {
return (context, next) => {
let index = -1
return dispatch(0)

View File

@ -2,6 +2,7 @@
* Provide hooks used only in jsx/dom
*/
import type { Context } from '../../context'
import { useContext } from '../../context'
import { createContext } from '../context'
import { useCallback, useState } from '../../hooks'
@ -20,7 +21,7 @@ type FormStatus =
method: 'get' | 'post'
action: string | ((formData: FormData) => void | Promise<void>)
}
export const FormContext = createContext<FormStatus>({
export const FormContext: Context<FormStatus> = createContext<FormStatus>({
pending: false,
data: null,
method: null,

View File

@ -344,7 +344,7 @@ const findChildNodeIndex = (
return
}
const cancelBuild = Symbol()
const cancelBuild: symbol = Symbol()
const applyNodeObject = (node: NodeObject, container: Container): void => {
const next: Node[] = []
const remove: Node[] = []

View File

@ -168,5 +168,8 @@ const formActionableElement = (
}
return newJSXNode(tag, props)
}
export const input = (props: PropsWithChildren) => formActionableElement('input', props)
export const button = (props: PropsWithChildren) => formActionableElement('button', props)
export const input: (props: PropsWithChildren) => unknown = (props) =>
formActionableElement('input', props)
export const button: (props: PropsWithChildren) => unknown = (props) =>
formActionableElement('button', props)