@@ -6,13 +6,16 @@ import { array, function_, safeParse, type InferOutput } from 'valibot';
66type MiddlewareWithInit < M extends ComponentMiddleware < any , any , any > , I > = ( init : I ) => ReturnType < M > | false ;
77
88const arrayOfFunctionSchema = array ( function_ ( ) ) ;
9+
10+ /** @deprecated New middleware should use `templatePolyMiddleware`. */
911const middlewareFactoryMarker = Symbol ( ) ;
1012
1113const isArrayOfFunction = ( middleware : unknown ) : middleware is InferOutput < typeof arrayOfFunctionSchema > =>
1214 safeParse ( arrayOfFunctionSchema , middleware ) . success ;
1315
1416const EMPTY_ARRAY = Object . freeze ( [ ] ) ;
1517
18+ /** @deprecated New middleware should use `templatePolyMiddleware`. */
1619// Following @types /react to use {} for props.
1720// eslint-disable-next-line @typescript-eslint/no-empty-object-type
1821function templateMiddleware < Request , Props extends { } > ( name : string ) {
@@ -92,8 +95,11 @@ function templateMiddleware<Request, Props extends {}>(name: string) {
9295 } ;
9396}
9497
98+ /** @deprecated New middleware should use `templatePolyMiddleware`. */
9599type InferMiddleware < T extends { '~types' : { middleware } } > = T [ '~types' ] [ 'middleware' ] ;
100+ /** @deprecated New middleware should use `templatePolyMiddleware`. */
96101type InferProps < T extends { '~types' : { props } } > = T [ '~types' ] [ 'props' ] ;
102+ /** @deprecated New middleware should use `templatePolyMiddleware`. */
97103type InferRequest < T extends { '~types' : { request } } > = T [ '~types' ] [ 'request' ] ;
98104
99105export default templateMiddleware ;
0 commit comments