Skip to content

Plans to support Typebox 1.x? #73

Open

Description

@jackyzha0

Thanks again for this wonderful piece of software! We currently rely on typebox-codegen in production for a few things and unfortunately this is making it difficult for us to upgrade to Typebox 1.x as typebox-codegen (to my understanding) doesn't yet support 1.x

Is this something that is planned on being supported?

Activity

  1. sinclairzx81 commented on May 11, 2026

    @sinclairzx81
    Owner

    @jackyzha0 Hi,

    Is this something that is planned on being supported?

    Yes, it's possible, but am trying to decide how I want to approach it. The TypeBox-Codegen project is developed on top of the TypeScript Compiler API (JavaScript), but where TypeBox 1.x actually developed it's own TypeScript Parser (and where the Codegen was a research prototype for the eventual 1.x Script function)

    https://github.com/sinclairzx81/typebox#script

    const { User, UserUpdate } = Type.Script(`
    
      interface Entity {
        id: string
      }
    
      interface User extends Entity { 
        name: string, 
        email: string 
      }
    
      type UserUpdate = Evaluate<
        Pick<User, keyof Entity> & 
        Partial<Omit<User, keyof Entity>>
      >
    `)

    The current TypeScript Compiler will eventually be phased out in favor of the Native GO compiler (TS7+), so I need to make a decision as to what I want to do here.

    1. Update Codegen to use the TypeScript 7 Native Compiler (WASM)
    2. Update Codegen to use the TypeBox Script Parse| Evaluator.

    I am somewhat leaning towards option (2), but there would be a few caveats to be mindful of. Mostly the JSDoc support isn't available in the TypeBox Script function, so If i do go this route, it would be a breaking change (implementations would need to update to the TB1X Options<T> type to specify metadata.

    Out of interest, what specific features of Codegen were you using? Was it just TS to TypeBox translation, or were you using some of the other library transforms? Let me know, as it would help being a bit of insight into how users are leveraging Codegen in projects.

    Hope this brings some insight into future updates to Codegen.
    Cheers!
    S

  2. jackyzha0 commented on May 11, 2026

    @jackyzha0
    Author

    We only use TypeScriptToTypeBox.Generate() (currently specifically for ts-proto generated interfaces). We don't currently use JSDoc or the other library transforms and don't currently plan on using it so option (2) seems very reasonable!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions