export async function validate( path: string, condition: boolean | (() => Promise<boolean>), message: string = "",) { try { type({ [path]: type("true").configure({ message: message ?? "Invalid value.", }), }).assert({ [path]: typeof condition === "function" ? await condition() : condition, }); } catch (e) { throw new TRPCError({ code: "BAD_REQUEST", cause: e, }); }}