Skip to content

Commit

Permalink
🏷️(frontend) fix intl type breakage from dependency
Browse files Browse the repository at this point in the history
We relied on having a type definition for `Intl.RelativeTimeFormat`
as we believed it existed in the typescript libs. It was really
coming from one of our dependencies extending `Intl` with it.

We can just type assert as the only call that uses `RelativeTimeFormat`
is to assert whether or not to run a polyfill.
  • Loading branch information
lunika committed Sep 23, 2019
1 parent 9aa845c commit 5401785
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/frontend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ document.addEventListener('DOMContentLoaded', async event => {
if (!Intl.PluralRules) {
await import('intl-pluralrules');
}

if (!Intl.RelativeTimeFormat) {
// TODO: remove type assertion when typescript libs include RelativeTimeFormat
if (!(Intl as any).RelativeTimeFormat) {
await import('@formatjs/intl-relativetimeformat');
// Get `react-intl`/`formatjs` lang specific parameters and data
await import(
Expand Down

0 comments on commit 5401785

Please sign in to comment.