Skip to content

Commit

Permalink
Update types and set Zod globally
Browse files Browse the repository at this point in the history
  • Loading branch information
kay-is committed Oct 19, 2023
1 parent 72f5372 commit b10bff9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import { WarpPlugin, WarpPluginType } from 'warp-contracts';
import { z } from 'zod';

declare global {
interface SmartWeave {
extensions: {
zod: typeof z;
};
}
export type Zod = typeof z;

export interface SmartweaveZodExtension {
extensions: {
z: Zod;
};
}

export class ZodExtension implements WarpPlugin<any, void> {
Expand All @@ -16,6 +16,7 @@ export class ZodExtension implements WarpPlugin<any, void> {
}

type(): WarpPluginType {
global.zod = z;
return 'smartweave-extension-zod';
}
}

0 comments on commit b10bff9

Please sign in to comment.