Skip to content

Polyfill: Fix type definition of Duration.toLocaleString#3101

Merged
ptomato merged 1 commit intotc39:mainfrom
printfn:duration-tolocalestring
Apr 17, 2025
Merged

Polyfill: Fix type definition of Duration.toLocaleString#3101
ptomato merged 1 commit intotc39:mainfrom
printfn:duration-tolocalestring

Conversation

@printfn
Copy link
Copy Markdown
Contributor

@printfn printfn commented Mar 14, 2025

The options argument of Duration.toLocaleString is incorrectly typed as Intl.DateTimeFormatOptions which is incorrect. For example this code fails typechecking:

duration.toLocaleString('en', { style: 'digital' })`

TypeScript's lib.d.ts does not yet include type definitions for Intl.DurationFormat, so I've added the relevant options manually. This can be removed once TypeScript has shipped support.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.05%. Comparing base (9999373) to head (c393eb8).
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3101   +/-   ##
=======================================
  Coverage   96.05%   96.05%           
=======================================
  Files          21       21           
  Lines        9951     9951           
  Branches     1802     1802           
=======================================
  Hits         9558     9558           
  Misses        346      346           
  Partials       47       47           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Collaborator

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ptomato ptomato merged commit a056783 into tc39:main Apr 17, 2025
@printfn printfn deleted the duration-tolocalestring branch April 17, 2025 22:18
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.

2 participants