Skip to content

DurationFormat imported globally doesn't provide type declarations #6013

Closed as not planned

Description

@michaeldoubek

Which package?

@formatjs/intl-durationformat

Describe the bug

Importing polyfill globally doesn't provide type declarations for Intl namespace.

To Reproduce

https://codesandbox.io/p/github/michaeldoubek/formatjs-polyfill-typescript-repro/draft/funny-rosalind?workspaceId=ws_BK8fKN2yN2ooPFqd3Nireg

It's in src/original-example.ts

Expected behavior

const formatter = new Intl.DurationFormat() won't result in Typescript error.

Desktop (please complete the following information):

  • OS: Mac OS
  • Node
  • Version 22

Additional context

Related to #6012 . If highlight note will be added to docs, it should be removed from docs when this is resolved.

Activity

  1. michaeldoubek commented on Feb 2, 2026

    @michaeldoubek
    ContributorAuthor

    Also would be willing to implement it, but it would be my first ever OSS contribution, so I would appreciate a bit of help 😄

  2. longlho commented on Feb 2, 2026

    @longlho
    Member

    yup PR's always welcome. Checkout our CONTRIBUTING.md for the dev setup

  3. michaeldoubek commented on Feb 3, 2026

    @michaeldoubek
    ContributorAuthor

    @longlho Ok, I'll do it. Guess I'll get to it this weekend. Assign me please.

  4. added a commit that references this issue on Mar 3, 2026
    581d8a2
  5. longlho commented on Mar 3, 2026

    @longlho
    Member

    TypeScript 5.9 now includes Intl.DurationFormat type declarations in lib.es2025.intl.d.ts. If you upgrade to TS 5.9+ and target es2025 or esnext, new Intl.DurationFormat() will have full type support out of the box.

    See: microsoft/TypeScript#60608

  6. ranisalt commented on Mar 16, 2026

    @ranisalt

    @longlho lib.es2025.intl.d.ts is not shipped with TypeScript as of 5.9.3 (latest)

    In fact, it even predates the PR that is supposed to add it microsoft/TypeScript#63046

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions