Skip to content

Commit 21f940d

Browse files
committed
Add deprecation
1 parent 5c5ceda commit 21f940d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/api/src/middleware/private/templateMiddleware.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ import { array, function_, safeParse, type InferOutput } from 'valibot';
66
type MiddlewareWithInit<M extends ComponentMiddleware<any, any, any>, I> = (init: I) => ReturnType<M> | false;
77

88
const arrayOfFunctionSchema = array(function_());
9+
10+
/** @deprecated New middleware should use `templatePolyMiddleware`. */
911
const middlewareFactoryMarker = Symbol();
1012

1113
const isArrayOfFunction = (middleware: unknown): middleware is InferOutput<typeof arrayOfFunctionSchema> =>
1214
safeParse(arrayOfFunctionSchema, middleware).success;
1315

1416
const 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
1821
function 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`. */
9599
type InferMiddleware<T extends { '~types': { middleware } }> = T['~types']['middleware'];
100+
/** @deprecated New middleware should use `templatePolyMiddleware`. */
96101
type InferProps<T extends { '~types': { props } }> = T['~types']['props'];
102+
/** @deprecated New middleware should use `templatePolyMiddleware`. */
97103
type InferRequest<T extends { '~types': { request } }> = T['~types']['request'];
98104

99105
export default templateMiddleware;

0 commit comments

Comments
 (0)