League-of-Foundry-Developers / foundry-vtt-types

Unofficial type declarations for the Foundry Virtual Tabletop API
MIT License
112 stars 54 forks source link

Add choices handling to `NumberField` #2555

Open JPMeehan opened 2 months ago

JPMeehan commented 2 months ago

The choices parameter in NumberFieldOptions should constrain the resulting type, but it does not currently.

Options for implementation

  1. Replicate the handling from StringField (easier solution)
  2. Find a way to share the type constraints with StringField (more DRY, possibly harder to implement)

Note that the choices parameter is implemented separately in the Foundry code.

Current example of the choices parameter for a NumberField is foundry.documents.BaseNote["textAnchor"]