typebox-codegen icon indicating copy to clipboard operation
typebox-codegen copied to clipboard

Unexpected token during transformation

Open madbence opened this issue 9 months ago • 0 comments

Compiling the following type results in a syntax error:

Codegen.TypeScriptToModel.Generate(`export type T = [string, ...string[]]`);

The thrown error:

    ...Type.Rest(string[])
                        ^

SyntaxError: Unexpected token ']'

The TypeScript type is also a generated one (from JSON schema, where the compiler defines a list with minItems: 1 like this), so I can probably find a workaround by relaxing the JSON schema.

madbence avatar Jul 04 '25 11:07 madbence