Skip to content

ModelToArkType fails to transform { [key: string]: any } | undefined #59

@kwonoj

Description

@kwonoj
const Code = `
export interface User {
  userId: string;
  settings: { [key: string]: any } | undefined;
}`;

const model = Codegen.TypeScriptToModel.Generate(Code);

const ark = Codegen.ModelToArkType.Generate(model);

raises an error

SyntaxError: Unterminated string literal. (5:30)
  3 | export const types = scope({
  4 | User: {
> 5 | userId: 'string',settings: '{
    |                              ^
  6 |
  7 | } | undefined'
  8 | },

Looks like it tries to transform { [key: string]: any } | undefined to '{} | undefined', which isn't supported syntax - might need type({}).or('undefined').

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