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

fix: revamp es2020.intl.d.ts #42945

Closed
wants to merge 1 commit into from
Closed

fix: revamp es2020.intl.d.ts #42945

wants to merge 1 commit into from

Conversation

longlho
Copy link
Contributor

@longlho longlho commented Feb 24, 2021

fractionalSecondDigits is in ES2021 (unpublished), not ES2020

  • Remove fractionalSecondDigits, dateStyle, timeStyle, dayPeriod since they're in ES2021 draft, not ES2020.
  • Clarify NumberFormatOptions, add list of sanctioned unit.

Fixes #42944

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Feb 24, 2021
@DanielRosenwasser
Copy link
Member

Was this in TS4.1? If not, maybe we should revert for TS4.2 @RyanCavanaugh

@longlho
Copy link
Contributor Author

longlho commented Feb 24, 2021

I believe this was in 4.2 but not 4.1. Our workaround rn is to pin to 4.1

@longlho longlho changed the title fix: remove fractionalSecondDigits from es2020.intl.d.ts fix: revamp es2020.intl.d.ts Feb 25, 2021
@longlho
Copy link
Contributor Author

longlho commented Feb 25, 2021

@DanielRosenwasser I apologize for increasing the scope of this PR but es2020 at its current state has some ES2021 stuff and also is missing some constraints in terms of unit.

- Remove `fractionalSecondDigits`, `dateStyle`, `timeStyle`, `dayPeriod`
since they're in ES2021 draft, not ES2020.
- Clarify NumberFormatOptions, add list of sanctioned unit
@longlho
Copy link
Contributor Author

longlho commented Mar 3, 2021

gentle ping @RyanCavanaugh :)

@sandersn sandersn requested review from sandersn and orta March 4, 2021 15:10
@sandersn
Copy link
Member

sandersn commented Mar 4, 2021

Maybe it was a related change, but I thought we had already made the types of something in intl into precise literal unions and then had to revert to the base primitive. Finding that change is the first step to reviewing this one, to make sure we don't end up waffling back and forth.

@longlho
Copy link
Contributor Author

longlho commented Mar 4, 2021

@sandersn so the context here is different and shouldn't be treated as blanket literal union vs none. The literal unions for those values are fine because the spec indicates that values outside of those choices, as of ES2020, will throw a RangeError. Specifically in this spec: https://402.ecma-international.org/7.0/#sec-initializenumberformat

Step 7 says numberingSystem is a string with no limited set of values, default to undefined (that's what GetOption does). This is why literal union change was reverted because the spec has no limit on sets of values. The previous union was pulled from LDML UTS#35 which is a separate spec.
However, step 19 says notation must be a string from a set of 4 values « "standard", "scientific", "engineering", "compact" », and default to standard. This is where literal union makes sense.

@DanielRosenwasser
Copy link
Member

@typescript-bot test this
@typescript-bot test dt
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 10, 2021

Heya @DanielRosenwasser, I've started to run the extended test suite on this PR at a4f4583. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 10, 2021

Heya @DanielRosenwasser, I've started to run the parallelized community code test suite on this PR at a4f4583. You can monitor the build here.

@DanielRosenwasser
Copy link
Member

@typescript-bot run dt

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 10, 2021

Heya @DanielRosenwasser, I've started to run the parallelized Definitely Typed test suite on this PR at a4f4583. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

@orta
Copy link
Contributor

orta commented Sep 8, 2021

Deprecated by #45647 - thanks @longlho

@orta orta closed this Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

es2020.intl.d.ts is inaccurate
5 participants