-
Notifications
You must be signed in to change notification settings - Fork 220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update this to as?: 'decimal' | 'currency' | 'percent';
so we fix the single problematic value, rather than widening the set of allowed values to include the es2020+ only 'unit'.
In TS 5.4 Intl.NumberFormatOptions['style']
was string | undefined
.
TS 5.5 strictens that up to be a set of possible values (keyof Intl.NumberFormatOptionsStyleRegistry
, the exact values of which change depending on which es version you're targeting - es5 supports decimal, percent and currency. es2020 adds unit).
No idea why /snapit
is installing TS 5.5 when we request ts 5.4 in the package.json though.
I'm not sure if we want to count this as a patch or major.
We're removing a "valid" value which is technically a breaking change
But MDN suggests that number
was never a valid value for the style option in the first place and doing Intl.NumberFormat('en', {style: 'number'})
is a runtime error. So we're making what was a runtime error now be highlighted at type-check time.
I'm tempted to try this as a patch change, do a snapit and see what breaks in web - if that's all good then do a patch.
45ab866
to
8e7d60b
Compare
/snapit |
8e7d60b
to
0d156dd
Compare
🫰✨ Thanks @alex-page! Your snapshots have been published to npm. Test the snapshots by updating your "@shopify/react-i18n": "0.0.0-snapshot-20240828004508",
"@shopify/react-i18n-universal-provider": "0.0.0-snapshot-20240828004508" |
Tophatted in There were some issues but they can be fixed forward in |
Updated
NumberFormatOptionsStyleRegistry
to align with latest version of typescript.