InvokeAI/invokeai/frontend/web/src/extend-zod.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

9 lines
231 B
TypeScript
Raw Normal View History

import { assert } from 'tsafe';
import { z } from 'zod';
assert(!Object.hasOwn(z.ZodType.prototype, 'is'));
z.ZodType.prototype.is = function (val: unknown): val is z.infer<typeof this> {
return this.safeParse(val).success;
};