Get values from type.enumerated?
```typescript
const ValidationErrorCodes = type.enumerated(
"INVALID_EMAIL",
"MISSING_FIELD",
"INVALID_FORMAT"...
Keep type name when using generic
I'm using a custom set of branding utilities (from ts-brand iirc).
```ts
export declare type AnyBrand = Brand<unknown, any>;
export declare type Brand<Base, Branding, ReservedName extends string = "type"> = Base & {...
About using a generic pipe
Hello everyone,
I am writing a schema in which one of the fields requiredness can be played with. I've come up with this type
```
const StringWithOptionalModification = type({...
Iterate over schema
Hello, I'm trying to create dynamic forms that would use ArkType to dynamically generate correct input type, but somehow I cannot find any good way to iterate over the schema. I've tried few things, and the only one that works is accessing
schema.json.required which is not even part of TS type of JSON (it just exists at runtime). Is there any easier way?
Basically what I'm looking for is for a way to turn some schema
```ts
const schema = type({...Matching on custom types
I have an array of errors (typed as
any[]) that I need to transform. I’d like to break the transformation into several match cases. I’ve already done this with the Fluent API, but I’m not sure if the same approach works with the string-based API.
```tsx
const FieldError = ({ title }: FieldErrorProps) => {
const field = useFieldContext();...empty string now but length string later?
For a few of my schemas i have them setup like this, which means the values can be empty string:
```ts
export const telephone = type({
international: "string",...
object but not array
how do we declare a schema that only accepts plain json object like
{} or {some: "key"} but not []?Is there a way to create custom validator string syntax?
I would want to be able to extend the awesome string typechecking
Is there a way to attach custom metadata to types?
Tried using .configure but doesn't seem I'm able to attach arbitrary properties.
default value for array
Is it possible to set the default value for an array to an empty array?
I'm trying to do something like this:
`...
const Thing = type({
array: "number.integer[] = []",
})
const Thing = type({
array: "number.integer[] = []",
})
Defining Records with narrowed keys
I couldn't find a way in the docs on object types (https://arktype.io/docs/objects) to define a record with narrowed keys. For example keys with no special symbols in them:
BAD
```ts
{...
default value for optional field
Hey! I have a question about handling optional fields with defaults.
I want to define a type where a property is optional in the input, but its value should never be undefined.
If the field is missing entirely, I want to transform the input so that the field is present in the result with a default value....
How to collect validation errors and custom errors in pipe
I have a pipe in which I want to add errors to the arkerrors array. But when there is an validation error, then only the validation error is outputted.
```
const pipedType = type({foo: 'string', bar: 'number'}).pipe((t, ctx) => {
if (t.foo === 'foo') {
ctx.error({...
Custom errors with morphs
Hello,
I am trying to have custom error messages on morphs. Here is an example for a Port type.
The error message is still the original one from Arktype.
...
Stringified array
Is there a type for stringified arrays i.e. elements joined with comma:
"item1,item2,item3"?Custom error message with conditions and i18n
Hi i am new here, and i try to create translated error messages. i have a schema like this.
```ts
const Thing = type({
price: type('string.numeric>0').configure({...
Minimal array length - how to?
This page https://arktype.io/docs/objects#arrays says one can use
[] > 1 to constrain minimal array length. However, this doesn't work:
```ts
import {type} from 'arktype'
...Prevent JsonSchema for type enumerated to become anyOf
Hello, when I have
type.enumerated('foo', 'bar').or(type.enumerated('foo', 'bar').array()).toJsonSchema(), the returned schema is:
```
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [...