Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!(types): Fix context type when chaining routes with middlewares #2046

Merged
merged 6 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 10 additions & 46 deletions deno_dist/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,7 @@ export interface HandlerInterface<
>(
path: P,
handler: H<E2, MergedPath, I, R>
): Hono<
IntersectNonAnyTypes<[E, E2]>,
S & ToSchema<M, MergePath<BasePath, P>, I['in'], MergeTypedResponseData<R>>,
BasePath
>
): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I['in'], MergeTypedResponseData<R>>, BasePath>

// app.get(path, handler x2)
<
Expand All @@ -412,11 +408,7 @@ export interface HandlerInterface<
>(
path: P,
...handlers: [H<E2, MergedPath, I>, H<E3, MergedPath, I2, R>]
): Hono<
IntersectNonAnyTypes<[E, E2, E3]>,
S & ToSchema<M, MergePath<BasePath, P>, I2['in'], MergeTypedResponseData<R>>,
BasePath
>
): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I2['in'], MergeTypedResponseData<R>>, BasePath>

// app.get(path, handler x3)
<
Expand All @@ -432,11 +424,7 @@ export interface HandlerInterface<
>(
path: P,
...handlers: [H<E2, MergedPath, I>, H<E3, MergedPath, I2>, H<E4, MergedPath, I3, R>]
): Hono<
IntersectNonAnyTypes<[E, E2, E3, E4]>,
S & ToSchema<M, MergePath<BasePath, P>, I3['in'], MergeTypedResponseData<R>>,
BasePath
>
): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I3['in'], MergeTypedResponseData<R>>, BasePath>

// app.get(path, handler x4)
<
Expand All @@ -459,11 +447,7 @@ export interface HandlerInterface<
H<E4, MergedPath, I3>,
H<E5, MergedPath, I4, R>
]
): Hono<
IntersectNonAnyTypes<[E, E2, E3, E4, E5]>,
S & ToSchema<M, MergePath<BasePath, P>, I4['in'], MergeTypedResponseData<R>>,
BasePath
>
): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I4['in'], MergeTypedResponseData<R>>, BasePath>

// app.get(path, handler x5)
<
Expand All @@ -489,11 +473,7 @@ export interface HandlerInterface<
H<E5, MergedPath, I4>,
H<E6, MergedPath, I5, R>
]
): Hono<
IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>,
S & ToSchema<M, MergePath<BasePath, P>, I5['in'], MergeTypedResponseData<R>>,
BasePath
>
): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I5['in'], MergeTypedResponseData<R>>, BasePath>

// app.get(path, handler x6)
<
Expand Down Expand Up @@ -522,11 +502,7 @@ export interface HandlerInterface<
H<E6, MergedPath, I5>,
H<E7, MergedPath, I6, R>
]
): Hono<
IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>,
S & ToSchema<M, MergePath<BasePath, P>, I6['in'], MergeTypedResponseData<R>>,
BasePath
>
): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I6['in'], MergeTypedResponseData<R>>, BasePath>

// app.get(path, handler x7)
<
Expand Down Expand Up @@ -558,11 +534,7 @@ export interface HandlerInterface<
H<E7, MergedPath, I6>,
H<E8, MergedPath, I7, R>
]
): Hono<
IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>,
S & ToSchema<M, MergePath<BasePath, P>, I7['in'], MergeTypedResponseData<R>>,
BasePath
>
): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I7['in'], MergeTypedResponseData<R>>, BasePath>

// app.get(path, handler x8)
<
Expand Down Expand Up @@ -597,11 +569,7 @@ export interface HandlerInterface<
H<E8, MergedPath, I7>,
H<E9, MergedPath, I8, R>
]
): Hono<
IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>,
S & ToSchema<M, MergePath<BasePath, P>, I8['in'], MergeTypedResponseData<R>>,
BasePath
>
): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I8['in'], MergeTypedResponseData<R>>, BasePath>

// app.get(path, handler x9)
<
Expand Down Expand Up @@ -639,11 +607,7 @@ export interface HandlerInterface<
H<E9, MergedPath, I8>,
H<E10, MergedPath, I9, R>
]
): Hono<
IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>,
S & ToSchema<M, MergePath<BasePath, P>, I9['in'], MergeTypedResponseData<R>>,
BasePath
>
): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I9['in'], MergeTypedResponseData<R>>, BasePath>

// app.get(path, handler x10)
<
Expand Down Expand Up @@ -685,7 +649,7 @@ export interface HandlerInterface<
H<E11, MergedPath, I10, R>
]
): Hono<
IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11]>,
E,
S & ToSchema<M, MergePath<BasePath, P>, I10['in'], MergeTypedResponseData<R>>,
BasePath
>
Expand Down
Loading
Loading