tc39 / tc39/proposal-amount

GetPreferredUnits asserts constraints on its region argument instead of expressing them in the parameter type

Open
#151 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.