How can we describe a string with a length restriction?
type("5 < string.numeric < 7").describe("valid otp")
type("5 < string.numeric < 7").describe("valid otp")
Encountering "Uncaught SyntaxError: Identifier 'module' has already been declared"
Optional required pairs?
Best way of sharing/compiling types?
Why are the partial operator `?` and explicit `undefined` incompatible?
Framework-level onDeepUndeclaredKey
email or empty string not working
export const feedbackSchema = type({
contact: 'string.email | string == 0'
});
export const feedbackSchema = type({
contact: 'string.email | string == 0'
});
Is there a recommended way to create a Record using a type as a key?
`narrow` vs `satisfying`
Are there docs on how to do non-trivial self reference?
this
keyword, but I'm looking to do something like:
```ts
const example = type({
name: "string",
selves: "this[]",...Some performance struggles
Using scope with morphs
string.json.parse
to read that data in and validate it.
```ts
const UserConfigSchema = scope({
config: type("string.json.parse").to({
// ERROR:...Passing an exported scope to a function (Type 'string' is not assignable to type 'never')
Is there a way to set a default value that is not valid?
""
, not undefined.
I am not sure how to define an Arktype type that accepts only an enum of values from the radio button, but defaults to empty-string. When I do the obvious inputType.default("")
I get errors:
ParseError: Default value is not assignable: must be "enum_option" (was "")
...Union Fallthrough?
Defining and inferring a generic type defined inside a scope
morphing to typescript type
type("string")
to try to parse out a Temporal.ZonedDateTime
type to sort of replicate what type("string.date.iso.parse")
does, and it mostly works. But I've noticed if I infer the TS type I can't actually assign a Temporal.ZoneDateTime
to the field, as tsc complains that the valueOf
signatures are different. Is this supposed to work, or should I be venturing down the path of scopes and rootSchema
instead?
```typescript
const zonedDateTimeISO = type("string")
.narrow((date, ctx) => {...Generic middleware validator
Compiling scope to interfaces