-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
feat(astro): improved validators #11195
Conversation
🦋 Changeset detectedLatest commit: c4127d2 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Can you update the RFC with these types? |
url: true, | ||
includes: 'foo', | ||
startsWith: 'bar', | ||
endsWith: 'baz' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the reason we can't have a check(value: string) => boolean
sort of thing is because this needs to happen at runtime, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah exactly, everything has to be serializable
max: 32, | ||
min: 3, | ||
length: 12, | ||
url: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do, does it turn it into a URL
object? If so I feel like a new type of URL, envField.url()
might be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the equivalent of z.string().url()
, so it only returns a string that is a valid url. Happy to add envField.url
if some users request it
I updated the RFC |
export type EnumFieldInput<T extends string> = Prettify< | ||
_FieldInput<typeof EnumSchema, 'type' | 'values' | 'default'> & { | ||
values: Array<T>; | ||
default?: NoInfer<T> | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been released in TS 5.4, could that be an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it should not
Can we merge this one @florian-lefebvre ? |
Yes, I was waiting in case Matthew wanted to follow up on the reviews |
Changes
envField
typesTesting
Added unit tests
Docs
N/A