GetPreferredUnits asserts constraints on its region argument instead of expressing them in the parameter type
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 58
- Forks
- 12
- Avg merge
- 2h 35m
- Merged PRs (30d)
- 2
Description
GetPreferredUnits declares its region_ parameter as just "a String", then asserts that it matches the unicode_region_id Unicode locale nonterminal and equals its own ASCII-uppercase. Constraints like these belong in the parameter's type, not in a runtime assertion (raised in https://github.com/tc39/proposal-amount/pull/110#discussion_r3257127253). The value comes from GetLocaleRegion, which 402 itself types as returning just a String.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating GetPreferredUnits and GetLocaleRegion in the proposal text, then read the linked TC39 discussion about the region_ parameter. Check how the proposal expresses parameter types and compare the existing runtime assertions with the return type of GetLocaleRegion. Done means the region constraints are represented in the parameter type rather than only asserted at runtime.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100