Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for TS Template Literal Types #32

Open
j-murata opened this issue Apr 27, 2023 · 1 comment
Open

Support for TS Template Literal Types #32

j-murata opened this issue Apr 27, 2023 · 1 comment

Comments

@j-murata
Copy link

It would be very helpful if zod-to-ts could convert .startWith() and .endsWidth() to TypeScript Template Literal Types.

For example:

import { z } from 'zod';
const fileUrlSchema = z.string().startsWith('file://');

↓ ↓ ↓

type FileUrl = `file://${string}`;
@sachinraja
Copy link
Owner

I think it's possible but we'd also have to add support for all the other helpers that zod has, which could take a bit of time. I'm open to PRs though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants