Skip to content

Commit

Permalink
deps: Update react-intl from v3 to v5, the latest.
Browse files Browse the repository at this point in the history
The upgrade guides for v4 [1] and v5 [2] are pretty short and
simple, so, might as well jump to the latest all at once.

Well, not quite the latest -- with 5.8.1 and following, `react-intl`
has `typescript` as a peer dependency, with the range "3.8 || 4".
Unfortunately, this range is disjoint with another peer-dep range
that caused us to add `typescript` in the first place; see
78daeb6. (See also
formatjs/formatjs#2067 (comment)
for a `react-intl` maintainer's flippant response to the idea of
using peer dependencies correctly.) So, use 5.8.0 precisely.

With v4 (and continuing into v5), we get a big stroke of luck for
the libdef. There's a single TypeScript file that contains all the
necessary types [3], so we only need to run Flowgen once, on that
one file. This saves a lot of the kind of work we had to do for v3.

The v4 declared breaking changes don't apply to us.

One v5 breaking change applies to us:

- `FormattedMessage` render prop is no longer variadic.

We've only ever cared about the first argument passed to the render
prop, so, grab just that one, to minimally handle the API change. In
fact, it seems like a bug that we're not paying attention to any
others that are passed. But it looks like no others are being
passed, currently; we haven't explicitly made that happen. But we'll
stop using this confusing pattern in an upcoming commit; see
discussion [4].

[1] https://formatjs.io/docs/react-intl/upgrade-guide-4x
[2] https://formatjs.io/docs/react-intl/upgrade-guide-5x
[3] except for React, which is normal, and which we'll address to
    some extent in the next commit.
[4] zulip#4222 (comment)
  • Loading branch information
chrisbobbe committed Oct 22, 2020
1 parent 3d30459 commit cb275ea
Show file tree
Hide file tree
Showing 4 changed files with 417 additions and 483 deletions.
Loading

0 comments on commit cb275ea

Please sign in to comment.