This pull request introduces improvements to the TypeScript type definitions. The primary goal of these changes is to enhance the support for Koa context typing, making the type definitions more flexible and robust for various usage scenarios.
Key Changes
Generic Type Parameters: Added generic type parameters StateT, ContextT, and ResponseBodyT to KoaProxies function. This allows users to specify custom state, context, and response body types, aligning more closely with Koa's native typing system.
Updated IBaseKoaProxiesOptions: Modified the IBaseKoaProxiesOptions interface to accept a generic ContextT type. This change provides better integration with custom Koa contexts.
Enhanced Type Safety: By introducing these generic parameters, the type definitions now offer improved type safety and developer experience in TypeScript environments.
Motivation
The motivation for these changes comes from encountering limitations with the current TypeScript definitions when working with custom Koa contexts. The lack of generic type support made it challenging to integrate koa-proxies seamlessly into TypeScript projects that utilize custom context types.
Impact
Backward Compatibility: These changes are backward compatible. Existing TypeScript projects using koa-proxies should not be affected.
Developer Experience: TypeScript users of koa-proxies will have a more seamless and type-safe experience, especially when dealing with custom Koa contexts.
This pull request introduces improvements to the TypeScript type definitions. The primary goal of these changes is to enhance the support for Koa context typing, making the type definitions more flexible and robust for various usage scenarios.
Key Changes
StateT
,ContextT
, andResponseBodyT
toKoaProxies
function. This allows users to specify custom state, context, and response body types, aligning more closely with Koa's native typing system.IBaseKoaProxiesOptions
: Modified theIBaseKoaProxiesOptions
interface to accept a genericContextT
type. This change provides better integration with custom Koa contexts.Motivation
The motivation for these changes comes from encountering limitations with the current TypeScript definitions when working with custom Koa contexts. The lack of generic type support made it challenging to integrate
koa-proxies
seamlessly into TypeScript projects that utilize custom context types.Impact
koa-proxies
should not be affected.koa-proxies
will have a more seamless and type-safe experience, especially when dealing with custom Koa contexts.Looking forward to feedback and suggestions!