Skip to content

fix: Handle regex values when generating types - #8010

Open
camdecoster wants to merge 4 commits into
mainfrom
cam/8003/handle-regex-in-types
Open

fix: Handle regex values when generating types#8010
camdecoster wants to merge 4 commits into
mainfrom
cam/8003/handle-regex-in-types

Conversation

@camdecoster

Copy link
Copy Markdown
Contributor

Description

Update schema type generator to handle regex values in enum attributes.

Closes #8003.

Changes

  • Update generator script to use types in place of regex patterns
  • Update axis number types to be more permissive (and move them)
  • Update generated types

Testing

  • Review the generated types and look for regex patterns
    • This can be done with grep in the project root (from the issue): grep -RF "'/^" src/types/generated/schema.d.ts

Notes

  • These patterns are valid in the schema, but not in TS
  • With no way to use regex to validate a type in TS, it was necessary to build a type that reasonably approximates the pattern (full parity isn't possible because the pattern has no upper bound for the numbers)
  • grid.xaxes, grid.yaxes, and grid.subplots were narrowed from any[] to typed arrays. This is correct, but could break some typing for users that used the more general string[] type.

@camdecoster
camdecoster marked this pull request as ready for review September 2, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Type definition uses regex as string literal type

1 participant