Files
Agent-n8n/n8n-n8n-1.109.2/packages/cli/src/zod-alias-support.ts
2025-09-08 04:48:28 +08:00

17 lines
356 B
TypeScript
Executable File

import { z } from 'zod';
// Monkey-patch zod to support aliases
declare module 'zod' {
interface ZodType {
alias<T extends ZodType>(this: T, aliasName: string): T;
}
interface ZodTypeDef {
_alias: string;
}
}
z.ZodType.prototype.alias = function <T extends z.ZodType>(this: T, aliasName: string) {
this._def._alias = aliasName;
return this;
};