ahrjarrett
ahrjarrett
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
For example:
const booleanJson = type.boolean.json
console.log(booleanJson)
// => [ { unit: false }, { unit: true } ]

// what I'm after is an API that let's me do this:

type([ { unit: false }, { unit: true }])

// or more directly:
type(type.boolean.json)
const booleanJson = type.boolean.json
console.log(booleanJson)
// => [ { unit: false }, { unit: true } ]

// what I'm after is an API that let's me do this:

type([ { unit: false }, { unit: true }])

// or more directly:
type(type.boolean.json)
36 replies
Aarktype
Created by ahrjarrett on 1/21/2025 in #questions
cross posting from #typescript
noob question! how would i express this type using arktype syntax?
type MyType = Record<string, unknown>[]
type MyType = Record<string, unknown>[]
i tried:
type(type.Record("string", type.unknown), "[]")
type(type.Record("string", type.unknown), "[]")
but it doesn't work on v2.0.0-rc.30.
16 replies