Skip to content
Discussion options

You must be logged in to vote

I don't know if there are projects out there besides @sinclair/typebox-codegen that generate ArkType types.

Regardless, I would still recommend an approach like I described because...

  • @ark/json-schema is guaranteed to be exactly 1-1 by arktype. If you've tested @sinclair/typebox-codegen and it works well for your needs, I'm very glad, but I can't make any guarantees.

  • If you are already running codegen, you should generate TS types directly from your JSON schema as well and then use those to cast the corresponding Types:

import { TypeA } from "./generatedTypes.ts"

export const TypeA = parseJsonSchema(typeASchema).as<TypeA>()

This saves a bunch of unnecessary tsserver overhead valida…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@VanTanev
Comment options

@ssalbdivad
Comment options

@VanTanev
Comment options

@ssalbdivad
Comment options

Answer selected by VanTanev
@VanTanev
Comment options

@kwonoj
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants