Skip to content

Commit 0df63d2

Browse files
committed
Removing deprecated alias ZodTypeAny.
1 parent bf5350e commit 0df63d2

7 files changed

Lines changed: 9 additions & 11 deletions

File tree

express-zod-api/src/api-response.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const responseVariants = Object.keys(
1111
) as ResponseVariant[];
1212

1313
/** @public this is the user facing configuration */
14-
export interface ApiResponse<S extends z.ZodTypeAny> {
14+
export interface ApiResponse<S extends z.ZodType> {
1515
schema: S;
1616
/** @default 200 for a positive and 400 for a negative response */
1717
statusCode?: number | [number, ...number[]];
@@ -31,7 +31,7 @@ export interface ApiResponse<S extends z.ZodTypeAny> {
3131
* @see normalize
3232
* */
3333
export interface NormalizedResponse {
34-
schema: z.ZodTypeAny;
34+
schema: z.ZodType;
3535
statusCodes: [number, ...number[]];
3636
mimeTypes: [string, ...string[]] | null;
3737
}

express-zod-api/src/integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ interface IntegrationParams {
4545
* @desc The schema to use for responses without body such as 204
4646
* @default z.undefined()
4747
* */
48-
noContent?: z.ZodTypeAny;
48+
noContent?: z.ZodType;
4949
/**
5050
* @desc Handling rules for your own branded schemas.
5151
* @desc Keys: brands (recommended to use unique symbols).

express-zod-api/src/result-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type Handler<RES = unknown> = (params: {
3030
logger: ActualLogger;
3131
}) => void | Promise<void>;
3232

33-
export type Result<S extends z.ZodTypeAny = z.ZodTypeAny> =
33+
export type Result<S extends z.ZodType = z.ZodType> =
3434
| S // plain schema, default status codes applied
3535
| ApiResponse<S> // single response definition, status code(s) customizable
3636
| ApiResponse<S>[]; // Feature #1431: different responses for different status codes (non-empty, prog. check!)

express-zod-api/src/sse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
logServerError,
1212
} from "./result-helpers";
1313

14-
type EventsMap = Record<string, z.ZodTypeAny>;
14+
type EventsMap = Record<string, z.ZodType>;
1515

1616
export interface Emitter<E extends EventsMap> extends FlatObject {
1717
/** @desc Returns true when the connection was closed or terminated */
@@ -20,7 +20,7 @@ export interface Emitter<E extends EventsMap> extends FlatObject {
2020
emit: <K extends keyof E>(event: K, data: z.input<E[K]>) => void;
2121
}
2222

23-
export const makeEventSchema = (event: string, data: z.ZodTypeAny) =>
23+
export const makeEventSchema = (event: string, data: z.ZodType) =>
2424
z.object({
2525
data,
2626
event: z.literal(event),

express-zod-api/src/zts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ const producers: HandlingRules<
256256
};
257257

258258
export const zodToTs = (
259-
schema: z.ZodTypeAny,
259+
schema: z.ZodType,
260260
{
261261
brandHandling,
262262
ctx,

express-zod-api/tests/index.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ describe("Index Entrypoint", () => {
8888
type: "openid";
8989
url: string;
9090
}>().toEqualTypeOf<OpenIdSecurity>();
91-
expectTypeOf({ schema: z.string() }).toExtend<
92-
ApiResponse<z.ZodTypeAny>
93-
>();
91+
expectTypeOf({ schema: z.string() }).toExtend<ApiResponse<z.ZodString>>();
9492
});
9593

9694
test("Extended Zod prototypes", () => {

express-zod-api/tests/integration.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from "../src";
1010

1111
describe("Integration", () => {
12-
const recursive1: z.ZodTypeAny = z.lazy(() =>
12+
const recursive1: z.ZodType = z.lazy(() =>
1313
z.object({
1414
name: z.string(),
1515
features: recursive1,

0 commit comments

Comments
 (0)