Fix route parameter typing to use SuffixTypeArray

This commit is contained in:
Garrett Mills 2022-06-28 21:04:49 -05:00
parent 705bb20db1
commit 2e43b5bda9
2 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@extollo/lib",
"version": "0.9.47",
"version": "0.9.48",
"description": "The framework library that lifts up your code.",
"main": "lib/index.js",
"types": "lib/index.d.ts",

View File

@ -1,4 +1,4 @@
import {Awaitable, Collection, Either, ErrorWithContext, Maybe, Pipeline, PrefixTypeArray, right} from '../../util'
import {Awaitable, Collection, Either, ErrorWithContext, Maybe, Pipeline, SuffixTypeArray, right} from '../../util'
import {ResponseFactory} from '../response/ResponseFactory'
import {HTTPMethod, Request} from '../lifecycle/Request'
import {constructable, Constructable, Container, Instantiable, isInstantiableOf, TypedDependencyKey} from '../../di'
@ -317,8 +317,8 @@ export class Route<TReturn extends ResponseObject, THandlerParams extends unknow
public parameterMiddleware<T, THandlerArgs extends any[] = []>(
handler: ParameterProvidingMiddleware<T> | Instantiable<ParameterMiddleware<T, THandlerArgs>>,
...handlerArgs: THandlerArgs
): Route<TReturn, PrefixTypeArray<T, THandlerParams>> {
const route = new Route<TReturn, PrefixTypeArray<T, THandlerParams>>(
): Route<TReturn, SuffixTypeArray<THandlerParams, T>> {
const route = new Route<TReturn, SuffixTypeArray<THandlerParams, T>>(
this.method,
this.route,
)
@ -409,7 +409,7 @@ export class Route<TReturn extends ResponseObject, THandlerParams extends unknow
return this
}
public input<T>(validator: ValidatorFactory<T>): Route<TReturn, PrefixTypeArray<Valid<T>, THandlerParams>> {
public input<T>(validator: ValidatorFactory<T>): Route<TReturn, SuffixTypeArray<THandlerParams, Valid<T>>> {
if ( !(validator instanceof Validator) ) {
validator = validator()
}
@ -422,7 +422,7 @@ export class Route<TReturn extends ResponseObject, THandlerParams extends unknow
return this.parameterMiddleware(validateMiddleware(validator))
}
public passingRequest(): Route<TReturn, PrefixTypeArray<Request, THandlerParams>> {
public passingRequest(): Route<TReturn, SuffixTypeArray<THandlerParams, Request>> {
return this.parameterMiddleware(request => right(request))
}