import { type } from "arktype"
const BaseSchema = type({
name: "string",
someField: "string | null",
});
const ASchema = BaseSchema.and({
type: "'typeA'",
someField: "string",
});
const BSchema = BaseSchema.and({
type: "'typeB'",
});
export const MySchema = ASchema.or(BSchema);
export type MySchemaType = typeof MySchema.infer;
import { type } from "arktype"
const BaseSchema = type({
name: "string",
someField: "string | null",
});
const ASchema = BaseSchema.and({
type: "'typeA'",
someField: "string",
});
const BSchema = BaseSchema.and({
type: "'typeB'",
});
export const MySchema = ASchema.or(BSchema);
export type MySchemaType = typeof MySchema.infer;