Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

tuple types are generated as containing unknown #62

Copy link
Copy link
@nneonneo

Description

@nneonneo
Issue body actions

Consider the following simple model:

from pydantic import BaseModel

class Sprite(BaseModel):
    path: str | None
    crop: tuple[int, int, int, int]
    hotspot: tuple[int, int]

Running uvx --from 'pydantic-to-typescript>=2' pydantic2ts --module test.py --output test.ts produces

/* tslint:disable */
/* eslint-disable */
/**
/* This file was automatically generated from pydantic models by running pydantic2ts.
/* Do not modify it by hand - just update the pydantic models and then re-run the script
*/

export interface Sprite {
  path: string | null;
  /**
   * @minItems 4
   * @maxItems 4
   */
  crop: [unknown, unknown, unknown, unknown];
  /**
   * @minItems 2
   * @maxItems 2
   */
  hotspot: [unknown, unknown];
}

The expected behaviour is that the tuples are encoded as e.g. [number, number, 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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.