Reducing interface and schema duplication
@sinclair/typebox
import { Type, Static } from "@sinclair/typebox";
export const widgetIdSchema = Type.Integer({
description: "The ID of the widget",
minimum: 0,
});
export type WidgetId = Static<typeof widgetIdSchema>;
export const widgetSchema = Type.Object({
id: widgetIdSchema,
name: Type.String({
description: "The name of the widget",
minLength: 1,
}),
});
export type Widget = Static<typeof widgetSchema>;Zod
Last updated