Validation
Usage
import { t } from '@marblejs/middleware-io';
export const UserDto = t.type({
id: t.string,
firstName: t.string,
lastName: t.string,
roles: t.array(t.union([
t.literal('ADMIN'),
t.literal('GUEST'),
])),
});
export type UserDto = t.TypeOf<typeof UserDto>;
/* π
type User = {
id: string;
name: string;
roles: ('ADMIN' | 'GUEST')[];
};Branded types
Optional properties
Last updated