0
0
mirror of https://github.com/honojs/hono.git synced 2024-12-01 11:51:01 +01:00

fix(type): add missing S to RemoveBlankRecord (#1354)

* fix(type): add missing S to RemoveBlankRecord

* fix(test): Fix testcase mistake

* run prettier
This commit is contained in:
sizumita 2023-08-20 15:45:22 +09:00 committed by GitHub
parent 8adc8c14c4
commit 4a027474f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 4 deletions

View File

@ -123,7 +123,7 @@ export interface HandlerInterface<
O = {}
>(
...handlers: Handler<E, P, I, O>[]
): Hono<E, RemoveBlankRecord<Schema<M, P, I['in'], O>>, BasePath>
): Hono<E, RemoveBlankRecord<S | Schema<M, P, I['in'], O>>, BasePath>
//// app.get(path, ...handlers[])
@ -430,7 +430,7 @@ export type UndefinedIfHavingQuestion<T> = T extends `${infer _}?` ? string | un
////// //////
////////////////////////////////////////
export type ExtractSchema<T> = T extends Hono<infer _, infer S, any> ? S : never
export type ExtractSchema<T> = UnionToIntersection<T extends Hono<infer _, infer S, any> ? S : never>
////////////////////////////////////////
////// //////

View File

@ -205,6 +205,19 @@ describe('HandlerInterface', () => {
output: {}
}
}
} & {
'/foo/:foo/books/:id': {
$post: {
input: {
param: {
id: string
} & {
foo: string
}
}
output: {}
}
}
}
type verify = Expect<Equal<Expected, Actual>>
})

View File

@ -123,7 +123,7 @@ export interface HandlerInterface<
O = {}
>(
...handlers: Handler<E, P, I, O>[]
): Hono<E, RemoveBlankRecord<Schema<M, P, I['in'], O>>, BasePath>
): Hono<E, RemoveBlankRecord<S | Schema<M, P, I['in'], O>>, BasePath>
//// app.get(path, ...handlers[])
@ -430,7 +430,9 @@ export type UndefinedIfHavingQuestion<T> = T extends `${infer _}?` ? string | un
////// //////
////////////////////////////////////////
export type ExtractSchema<T> = T extends Hono<infer _, infer S, any> ? S : never
export type ExtractSchema<T> = UnionToIntersection<
T extends Hono<infer _, infer S, any> ? S : never
>
////////////////////////////////////////
////// //////