Skip to content

Option to convert constant size arrays into tuples #1884

@orhanhenrik

Description

@orhanhenrik

When generating types for a constant size array, I would like to have an option to convert it to a constant size array / tuple in typescript.

Example

MyModel: {
  type: 'object',
  properties: {
    coordinates: {
      type: 'array',
      items: {
        type: 'number',
      },
      minItems: 2,
      maxItems: 2,
    },
  },
},

Would convert to

export type MyModel = {
  coordinates: Array<number>;
}

currently, but I would like the option to convert it to

export type MyModel = {
  coordinates: [number, number];
}

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