From 530807177190564432fe91a955dfa95ee852f7d9 Mon Sep 17 00:00:00 2001 From: sushichan044 Date: Fri, 15 Nov 2024 16:33:59 +0900 Subject: [PATCH] fix(types): Calculate Context type for each handler (#3587) --- src/helper/factory/index.test.ts | 107 ++++++-- src/helper/factory/index.ts | 72 +++--- src/types.test.ts | 45 ++++ src/types.ts | 416 +++++++++++++++---------------- 4 files changed, 380 insertions(+), 260 deletions(-) diff --git a/src/helper/factory/index.test.ts b/src/helper/factory/index.test.ts index 30fe77b61..d7c45da96 100644 --- a/src/helper/factory/index.test.ts +++ b/src/helper/factory/index.test.ts @@ -231,22 +231,97 @@ describe('createHandler', () => { describe('Types - Context Env with Multiple Middlewares', () => { const factory = createFactory() - const mw1 = createMiddleware<{ Variables: { foo: string } }>(async (c, next) => { - c.set('foo', 'bar') - await next() - }) - - const mw2 = createMiddleware<{ Variables: { bar: number } }>(async (c, next) => { - c.set('bar', 1) - await next() - }) - - it('Should set the correct type for context from multiple middlewares', () => { - factory.createHandlers(mw1, mw2, (c) => { - expectTypeOf(c.var.foo).toEqualTypeOf() - expectTypeOf(c.var.bar).toEqualTypeOf() - - return c.json({ foo: c.var.foo, bar: c.var.bar }) + const mw1 = createMiddleware< + { Variables: { foo1: string } }, + string, + { out: { query: { bar1: number } } } + >(async () => {}) + const mw2 = createMiddleware< + { Variables: { foo2: string } }, + string, + { out: { query: { bar2: number } } } + >(async () => {}) + const mw3 = createMiddleware< + { Variables: { foo3: string } }, + string, + { out: { query: { bar3: number } } } + >(async () => {}) + const mw4 = createMiddleware< + { Variables: { foo4: string } }, + string, + { out: { query: { bar4: number } } } + >(async () => {}) + const mw5 = createMiddleware< + { Variables: { foo5: string } }, + string, + { out: { query: { bar5: number } } } + >(async () => {}) + const mw6 = createMiddleware< + { Variables: { foo6: string } }, + string, + { out: { query: { bar6: number } } } + >(async () => {}) + const mw7 = createMiddleware< + { Variables: { foo7: string } }, + string, + { out: { query: { bar7: number } } } + >(async () => {}) + const mw8 = createMiddleware< + { Variables: { foo8: string } }, + string, + { out: { query: { bar8: number } } } + >(async () => {}) + const mw9 = createMiddleware< + { Variables: { foo9: string } }, + string, + { out: { query: { bar9: number } } } + >(async () => {}) + + it('Should not throw type error', () => { + factory.createHandlers( + mw1, + mw2, + mw3, + mw4, + mw5, + mw6, + mw7, + mw8, + async (c) => { + expectTypeOf(c.var.foo1).toEqualTypeOf() + expectTypeOf(c.var.foo2).toEqualTypeOf() + expectTypeOf(c.var.foo3).toEqualTypeOf() + expectTypeOf(c.var.foo4).toEqualTypeOf() + expectTypeOf(c.var.foo5).toEqualTypeOf() + expectTypeOf(c.var.foo6).toEqualTypeOf() + expectTypeOf(c.var.foo7).toEqualTypeOf() + expectTypeOf(c.var.foo8).toEqualTypeOf() + }, + (c) => c.json(0) + ) + + factory.createHandlers(mw1, mw2, mw3, mw4, mw5, mw6, mw7, mw8, mw9, (c) => { + expectTypeOf(c.var.foo1).toEqualTypeOf() + expectTypeOf(c.var.foo2).toEqualTypeOf() + expectTypeOf(c.var.foo3).toEqualTypeOf() + expectTypeOf(c.var.foo4).toEqualTypeOf() + expectTypeOf(c.var.foo5).toEqualTypeOf() + expectTypeOf(c.var.foo6).toEqualTypeOf() + expectTypeOf(c.var.foo7).toEqualTypeOf() + expectTypeOf(c.var.foo8).toEqualTypeOf() + expectTypeOf(c.var.foo9).toEqualTypeOf() + + return c.json({ + foo1: c.get('foo1'), + foo2: c.get('foo2'), + foo3: c.get('foo3'), + foo4: c.get('foo4'), + foo5: c.get('foo5'), + foo6: c.get('foo6'), + foo7: c.get('foo7'), + foo8: c.get('foo8'), + foo9: c.get('foo9'), + }) }) }) }) diff --git a/src/helper/factory/index.ts b/src/helper/factory/index.ts index 49a3cb1c9..f5e6411ce 100644 --- a/src/helper/factory/index.ts +++ b/src/helper/factory/index.ts @@ -40,7 +40,7 @@ export interface CreateHandlersInterface { I3 extends Input = I & I2, R extends HandlerResponse = any, E2 extends Env = E, - E3 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]> >( handler1: H, @@ -56,8 +56,8 @@ export interface CreateHandlersInterface { I4 extends Input = I & I2 & I3, R extends HandlerResponse = any, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]> >( handler1: H, @@ -75,9 +75,9 @@ export interface CreateHandlersInterface { I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse = any, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]> >( handler1: H, @@ -97,10 +97,10 @@ export interface CreateHandlersInterface { I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse = any, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]> >( handler1: H, @@ -129,11 +129,11 @@ export interface CreateHandlersInterface { I7 extends Input = I & I2 & I3 & I4 & I5 & I6, R extends HandlerResponse = any, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]> >( handler1: H, @@ -165,12 +165,12 @@ export interface CreateHandlersInterface { I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, R extends HandlerResponse = any, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]> >( handler1: H, @@ -205,13 +205,13 @@ export interface CreateHandlersInterface { I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, R extends HandlerResponse = any, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]> >( handler1: H, @@ -249,14 +249,14 @@ export interface CreateHandlersInterface { I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, R extends HandlerResponse = any, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, - E10 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, + E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]> >( handler1: H, diff --git a/src/types.test.ts b/src/types.test.ts index 421570abe..509d08457 100644 --- a/src/types.test.ts +++ b/src/types.test.ts @@ -1298,6 +1298,28 @@ describe('c.var with chaining - test only types', () => { return c.json(0) }) + new Hono().get( + mw1, + mw2, + mw3, + mw4, + mw5, + mw6, + mw7, + mw8, + async (c) => { + expectTypeOf(c.var.foo1).toEqualTypeOf() + expectTypeOf(c.var.foo2).toEqualTypeOf() + expectTypeOf(c.var.foo3).toEqualTypeOf() + expectTypeOf(c.var.foo4).toEqualTypeOf() + expectTypeOf(c.var.foo5).toEqualTypeOf() + expectTypeOf(c.var.foo6).toEqualTypeOf() + expectTypeOf(c.var.foo7).toEqualTypeOf() + expectTypeOf(c.var.foo8).toEqualTypeOf() + }, + (c) => c.json(0) + ) + new Hono().get(mw1, mw2, mw3, mw4, mw5, mw6, mw7, mw8, mw9, (c) => { expectTypeOf(c.req.valid('query')).toMatchTypeOf<{ bar1: number @@ -1314,6 +1336,29 @@ describe('c.var with chaining - test only types', () => { return c.json(0) }) + new Hono().get( + '/', + mw1, + mw2, + mw3, + mw4, + mw5, + mw6, + mw7, + mw8, + async (c) => { + expectTypeOf(c.var.foo1).toEqualTypeOf() + expectTypeOf(c.var.foo2).toEqualTypeOf() + expectTypeOf(c.var.foo3).toEqualTypeOf() + expectTypeOf(c.var.foo4).toEqualTypeOf() + expectTypeOf(c.var.foo5).toEqualTypeOf() + expectTypeOf(c.var.foo6).toEqualTypeOf() + expectTypeOf(c.var.foo7).toEqualTypeOf() + expectTypeOf(c.var.foo8).toEqualTypeOf() + }, + (c) => c.json(0) + ) + new Hono().get('/', mw1, mw2, mw3, mw4, mw5, mw6, mw7, mw8, mw9, (c) => { expectTypeOf(c.req.valid('query')).toMatchTypeOf<{ bar1: number diff --git a/src/types.ts b/src/types.ts index f58f162bd..24437493a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -157,7 +157,7 @@ export interface HandlerInterface< I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, - E3 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]> >( ...handlers: [H, H, H] @@ -190,8 +190,8 @@ export interface HandlerInterface< I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]> >( ...handlers: [H, H, H, H] @@ -210,7 +210,7 @@ export interface HandlerInterface< I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, - E3 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]> >( path: P, @@ -227,9 +227,9 @@ export interface HandlerInterface< I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]> >( ...handlers: [H, H, H, H, H] @@ -249,8 +249,8 @@ export interface HandlerInterface< I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]> >( path: P, @@ -273,10 +273,10 @@ export interface HandlerInterface< I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]> >( ...handlers: [ @@ -304,9 +304,9 @@ export interface HandlerInterface< I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]> >( path: P, @@ -331,11 +331,11 @@ export interface HandlerInterface< I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]> >( ...handlers: [ @@ -365,10 +365,10 @@ export interface HandlerInterface< I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]> >( path: P, @@ -395,12 +395,12 @@ export interface HandlerInterface< I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]> >( ...handlers: [ @@ -432,11 +432,11 @@ export interface HandlerInterface< I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]> >( path: P, @@ -465,13 +465,13 @@ export interface HandlerInterface< I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]> >( ...handlers: [ @@ -505,12 +505,12 @@ export interface HandlerInterface< I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]> >( path: P, @@ -541,14 +541,14 @@ export interface HandlerInterface< I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, - E10 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, + E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]> >( ...handlers: [ @@ -584,13 +584,13 @@ export interface HandlerInterface< I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]> >( path: P, @@ -623,14 +623,14 @@ export interface HandlerInterface< I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, - E10 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, + E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]> >( path: P, @@ -712,7 +712,7 @@ export interface MiddlewareHandlerInterface< // app.use(handler x3) < E2 extends Env = E, - E3 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, P extends string = MergePath> >( @@ -733,8 +733,8 @@ export interface MiddlewareHandlerInterface< // app.use(handler x4) < E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, P extends string = MergePath> >( @@ -751,7 +751,7 @@ export interface MiddlewareHandlerInterface< P extends string, MergedPath extends MergePath = MergePath, E2 extends Env = E, - E3 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]> >( path: P, @@ -761,9 +761,9 @@ export interface MiddlewareHandlerInterface< // app.use(handler x5) < E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, P extends string = MergePath> >( @@ -781,8 +781,8 @@ export interface MiddlewareHandlerInterface< P extends string, MergedPath extends MergePath = MergePath, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]> >( path: P, @@ -801,10 +801,10 @@ export interface MiddlewareHandlerInterface< // app.use(handler x6) < E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, P extends string = MergePath> >( @@ -823,9 +823,9 @@ export interface MiddlewareHandlerInterface< P extends string, MergedPath extends MergePath = MergePath, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]> >( path: P, @@ -845,11 +845,11 @@ export interface MiddlewareHandlerInterface< // app.use(handler x7) < E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, P extends string = MergePath> >( @@ -869,10 +869,10 @@ export interface MiddlewareHandlerInterface< P extends string, MergedPath extends MergePath = MergePath, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]> >( path: P, @@ -893,12 +893,12 @@ export interface MiddlewareHandlerInterface< // app.use(handler x8) < E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, P extends string = MergePath> >( @@ -919,11 +919,11 @@ export interface MiddlewareHandlerInterface< P extends string, MergedPath extends MergePath = MergePath, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]> >( path: P, @@ -945,13 +945,13 @@ export interface MiddlewareHandlerInterface< // app.use(handler x9) < E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, P extends string = MergePath> >( @@ -973,12 +973,12 @@ export interface MiddlewareHandlerInterface< P extends string, MergedPath extends MergePath = MergePath, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]> >( path: P, @@ -1001,14 +1001,14 @@ export interface MiddlewareHandlerInterface< // app.use(handler x10) < E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, - E10 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, + E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, P extends string = MergePath> >( @@ -1031,13 +1031,13 @@ export interface MiddlewareHandlerInterface< P extends string, MergedPath extends MergePath = MergePath, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]> >( path: P, @@ -1124,7 +1124,7 @@ export interface OnHandlerInterface< I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, - E3 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]> >( method: M, @@ -1147,8 +1147,8 @@ export interface OnHandlerInterface< I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]> >( method: M, @@ -1177,9 +1177,9 @@ export interface OnHandlerInterface< I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]> >( method: M, @@ -1210,10 +1210,10 @@ export interface OnHandlerInterface< I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]> >( method: M, @@ -1246,11 +1246,11 @@ export interface OnHandlerInterface< I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]> >( method: M, @@ -1285,12 +1285,12 @@ export interface OnHandlerInterface< I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]> >( method: M, @@ -1327,13 +1327,13 @@ export interface OnHandlerInterface< I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]> >( method: M, @@ -1371,14 +1371,14 @@ export interface OnHandlerInterface< I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, - E10 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, + E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]> >( method: M, @@ -1461,7 +1461,7 @@ export interface OnHandlerInterface< I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, - E3 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]> >( methods: Ms, @@ -1484,8 +1484,8 @@ export interface OnHandlerInterface< I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]> >( methods: Ms, @@ -1514,9 +1514,9 @@ export interface OnHandlerInterface< I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]> >( methods: Ms, @@ -1547,10 +1547,10 @@ export interface OnHandlerInterface< I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]> >( methods: Ms, @@ -1583,11 +1583,11 @@ export interface OnHandlerInterface< I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]> >( methods: Ms, @@ -1622,12 +1622,12 @@ export interface OnHandlerInterface< I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]> >( methods: Ms, @@ -1663,13 +1663,13 @@ export interface OnHandlerInterface< I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]> >( methods: Ms, @@ -1707,14 +1707,14 @@ export interface OnHandlerInterface< I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, E2 extends Env = E, - E3 extends Env = E, - E4 extends Env = E, - E5 extends Env = E, - E6 extends Env = E, - E7 extends Env = E, - E8 extends Env = E, - E9 extends Env = E, - E10 extends Env = E, + E3 extends Env = IntersectNonAnyTypes<[E, E2]>, + E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, + E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, + E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, + E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, + E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, + E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, + E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]> >( methods: Ms,