Skip to content

Instantly share code, notes, and snippets.

@minodisk
Created August 26, 2022 10:57
Show Gist options
  • Save minodisk/c440ae556d89c3b231dbfc9b3e4078a3 to your computer and use it in GitHub Desktop.
Save minodisk/c440ae556d89c3b231dbfc9b3e4078a3 to your computer and use it in GitHub Desktop.
import { generate } from "ts-to-zod";
import clipboard from "clipboardy";
(async () => {
const sourceText = await clipboard.read();
const schema = generate({
sourceText,
})
.getZodSchemasFile()
.replace("// Generated by ts-to-zod\n", "");
await clipboard.write(schema);
process.stdout.write("Copy zod schema to clipboard.\n");
process.exit(0);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment