arktype

A

arktype

This is a friendly space centered around ArkType, TypeScript's 1:1 validator (https://github.com/arktypeio/arktype)

Join

Type 'distillOut<T>' is not assignable to type 'T'.

```ts import { type, Type } from "arktype"; const test = <T>(validator: Type<T>): T => { const result = validator({});...

How to improve error messages?

address must be a string and less than length 200 and more than length 50 and valid according to an anonymous predicate and valid according to an anonymous predicate and valid according to an anonymous predicate (was missing)
This is an example of a validation error message returned. How could I go about making that a little more human friendly?...

Pipe required before narrow

const myFunc = (v: string) => true;
const MyString = type("50<string<200").narrow((s) => myFunc(s));
const myFunc = (v: string) => true;
const MyString = type("50<string<200").narrow((s) => myFunc(s));
Results in error:...

Error transforming object

I'm having some trouble doing transforming some data

Problem with Out type

Type '(In: string) => Out<bigint>' is not assignable to type 'bigint'
Type '(In: string) => Out<bigint>' is not assignable to type 'bigint'

Context-sensitive validation / validation with parameters

```ts interface Thing { bars: string[]; foo: { baz: { bar: string }[]; }[]; }...

Validate string is URL

What would be the easiest way to validate that the url in here is an actual valid url? ```ts const button = type({ label: "2<=string<=32", url: "2<=string<=512",...

Array/Object keys to type?

So I got this object: ```ts export const supportedLanguages: { afr: Language; ara: Language;...

Nesting ArkTypes within a regex

Is there a way to put ArkType types within a regex? As an example
const x = type("0<string<3");
const y = type("0<number<10");
const z = type("/x y/");
const x = type("0<string<3");
const y = type("0<number<10");
const z = type("/x y/");
where for z something like hi 3 would be valid, but not hi 13 or hello 5 -- i.e. to be valid, the value passed into z has to be a string of length 1 or 2, followed by a space, followed by a number 1-9 (inclusive))...

Custom type-making functions

I want to make a chainable that can create types the same way type does How do I implement that? ```ts thing // Thing<never, never> .input('number%1>0') // Thing<number, never>...

Syntax Overview

Someone was asking for an overview of available syntax. I ended up coming this and figured it would be useful to post it here. It doesn't include everything (notably most tuple expressions and scopes), but it's a good place to start: ```ts...
No description

How to access current scope types with `type()` / `morph()` / `narrow()` / `arrayOf()` inside scope?

How to access current scope types with type() / morph() / narrow() / arrayOf() inside scope? ```ts const $ = scope({ blah: "1 < number < 10", blahArray: () => $.type("blah[]")...