Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to "June 15, 2021 Release" leads to build errors because of Intl.DateTimeFormatOptions#fractionalSecondDigits #2096

Closed
tomsontom opened this issue Jul 6, 2021 · 2 comments
Labels
help wanted Extra attention is needed typescript

Comments

@tomsontom
Copy link
Contributor

🐛 Bug Report

We upgraded our project to the latest version and now we are getting a build failure (on typescript 4.0.x):

../../../../node_modules/@formatjs/ecma402-abstract/types/date-time.d.ts(8,59): error TS2344: Type '"day" | "era" | "hour" | "minute" | "month" | "second" | "timeZoneName" | "weekday" | "year" | "fractionalSecondDigits"' does not satisfy the constraint '"day" | "era" | "hour" | "minute" | "month" | "second" | "timeZoneName" | "weekday" | "year" | "numberingSystem" | "hourCycle" | "dateStyle" | "timeStyle" | "calendar" | "localeMatcher" | "formatMatcher" | "hour12" | "timeZone"'.
  Type '"fractionalSecondDigits"' is not assignable to type '"day" | "era" | "hour" | "minute" | "month" | "second" | "timeZoneName" | "weekday" | "year" | "numberingSystem" | "hourCycle" | "dateStyle" | "timeStyle" | "calendar" | "localeMatcher" | "formatMatcher" | "hour12" | "timeZone"'.

Looking at the git repo I see #1872 introduced a dev package and so spectrum build itself is happy but downstream users are not because the requested "fractionalSecondDigits" is not available unless you upgrade to the latest typescript version (4.3.5)

🤔 Expected Behavior

Upgrading to the latest version just works without the updating typescript version. Or it has to be specified in the release notes what the minimal version of typescript is required.

😯 Current Behavior

Build just fails and has to upgraded to the current typescript version - at the time of this writing 4.3.5 (see below why that might fail in future as well)

💁 Possible Solution

  • Update typescript 4.3.5
  • patch @formatjs/ecma402-abstract/types/date-time.d.ts

One caveat with solution 2 is: microsoft/TypeScript#42945 so there's the potential to get broken again.

🔦 Context

Our product build got broken.

💻 Code Sample

🌍 Your Environment

Software Version(s)
react-spectrum
Browser
Operating System

🧢 Your Company/Team

🕷 Tracking Issue (optional)

@snowystinger
Copy link
Member

So I see the issue, and it seems we've just pushed formatjs' issue onto you. We're looking into ways not to do that.

It's a bit difficult because it's using the Intl namespace in types, and it's using it internally, so the only way to add that is the overrides file that we have. This is not ideal because we'd need to publish it with our package for you to get it; also, it's overriding something that has been addressed in a future version and may conflict with anything you've done. We've no wish to be maintainers of the types for Intl.

We can't make a dependency or peer dependency on TS because that'd interfere with our library users that don't use TS at all.

I don't think upgrading our version of TS solves the issue. However, it's a pretty good solution for you. I'm not sure the best way to signal that the TS version we rely on has been bumped up. Even DefinitelyTyped doesn't have any dep/peerdep requirements. They just say they support the last two.

All this to say, we're open to ideas.

@LFDanLu LFDanLu added help wanted Extra attention is needed typescript labels Jul 27, 2021
@devongovett
Copy link
Member

Should be fixed by #3046.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed typescript
Projects
None yet
Development

No branches or pull requests

4 participants