Model required currency/unit options for Intl.NumberFormat currency/unit styles - #64335
Draft
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 2 commits into
Draft
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 2 commits into
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 2 commits into
Conversation
Copilot started work on behalf of
Ryan Cavanaugh (RyanCavanaugh)
September 19, 2026 01:25
View session
…nit styles Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Intl.NumberFormat missing properties for currency style
Model required currency/unit options for Intl.NumberFormat currency/unit styles
Sep 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intl.NumberFormatOptionsallowedstyle: "currency"without acurrencystring (or withcurrency: undefined), which compiles cleanly under--strictbut throwsTypeError: Currency code is required with currency style.at runtime. Same gap exists forstyle: "unit"/unit.Changes
NumberFormatOptionsStyleRequiredOptionsRegistry(lib.es5.d.ts), mapping each style name to the extra properties required for that style (currency: { currency: string }inlib.es5.d.ts,unit: { unit: string }added inlib.es2020.intl.d.ts).NumberFormatConstructor's call/construct signatures are now generic over the options object, intersecting it withNumberFormatOptionsStyleRequiredOptions<T["style"]>computed from the registry — mirrors the discriminated-overload pattern already used elsewhere in lib.d.ts (e.g.addEventListener), avoiding a breaking rewrite ofNumberFormatOptionsinto a full union that would conflict with its declaration-merging registry pattern across lib versions.supportedLocalesOfis left untouched, since it doesn't perform this runtime validation.NumberFormatOptions) are unaffected — the check only applies whenstyleis inferred as a literal from an object literal argument.Tests
intlNumberFormatRequiredStyleOptions.tscovering both new error cases and previously-valid usages that must remain unaffected.styleis set tocurrency#57514