Fixed types.

This commit is contained in:
Mike Cao 2023-11-13 21:58:23 -08:00
parent 8775d696b8
commit a78d11e352
5 changed files with 74 additions and 64 deletions

View File

@ -102,7 +102,7 @@
"react-beautiful-dnd": "^13.1.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.4",
"react-intl": "^6.4.7",
"react-intl": "^6.5.5",
"react-simple-maps": "^2.3.0",
"react-use-measure": "^2.0.4",
"react-window": "^1.8.6",

View File

@ -11,10 +11,10 @@ export function MobileMenu({
items: any[];
className?: string;
onClose: () => void;
}) {
}): any {
const pathname = usePathname();
const Items = ({ items, className }: { items: any[]; className?: string }) => (
const Items = ({ items, className }: { items: any[]; className?: string }): any => (
<div className={classNames(styles.items, className)}>
{items.map(({ label, url, children }: { label: string; url: string; children: any[] }) => {
const selected = pathname.startsWith(url);

View File

@ -1,7 +1,8 @@
import { useIntl, FormattedMessage } from 'react-intl';
import { useIntl, FormattedMessage, MessageDescriptor, PrimitiveType } from 'react-intl';
import { messages, labels } from 'components/messages';
import { FormatXMLElementFn, Options } from 'intl-messageformat';
export function useMessages() {
export function useMessages(): any {
const intl = useIntl();
const getMessage = (id: string) => {
@ -10,7 +11,16 @@ export function useMessages() {
return message ? formatMessage(message) : id;
};
const formatMessage = (descriptor: any, values?: any, opts?: any) => {
const formatMessage = (
descriptor:
| MessageDescriptor
| {
id: string;
defaultMessage: string;
},
values?: Record<string, PrimitiveType | FormatXMLElementFn<string, string>>,
opts?: Options,
) => {
return descriptor ? intl.formatMessage(descriptor, values, opts) : null;
};

View File

@ -17,7 +17,7 @@ export function useNavigation() {
return obj;
}, [params]);
function makeUrl(params, reset) {
function makeUrl(params: any, reset?: boolean) {
return reset ? pathname : buildUrl(pathname, { ...query, ...params });
}

114
yarn.lock
View File

@ -1353,12 +1353,12 @@
"@formatjs/intl-localematcher" "0.2.25"
tslib "^2.1.0"
"@formatjs/ecma402-abstract@1.17.2":
version "1.17.2"
resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.17.2.tgz#d197c6e26b9fd96ff7ba3b3a0cc2f25f1f2dcac3"
integrity sha512-k2mTh0m+IV1HRdU0xXM617tSQTi53tVR2muvYOsBeYcUgEAyxV1FOC7Qj279th3fBVQ+Dj6muvNJZcHSPNdbKg==
"@formatjs/ecma402-abstract@1.18.0":
version "1.18.0"
resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.18.0.tgz#e2120e7101020140661b58430a7ff4262705a2f2"
integrity sha512-PEVLoa3zBevWSCZzPIM/lvPCi8P5l4G+NXQMc/CjEiaCWgyHieUoo0nM7Bs0n/NbuQ6JpXEolivQ9pKSBHaDlA==
dependencies:
"@formatjs/intl-localematcher" "0.4.2"
"@formatjs/intl-localematcher" "0.5.2"
tslib "^2.4.0"
"@formatjs/ecma402-abstract@1.4.0":
@ -1391,13 +1391,13 @@
"@formatjs/icu-skeleton-parser" "1.3.6"
tslib "^2.1.0"
"@formatjs/icu-messageformat-parser@2.7.0":
version "2.7.0"
resolved "https://registry.yarnpkg.com/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.7.0.tgz#9b13f2710a3b4efddfeb544480f684f27a53483b"
integrity sha512-7uqC4C2RqOaBQtcjqXsSpGRYVn+ckjhNga5T/otFh6MgxRrCJQqvjfbrGLpX1Lcbxdm5WH3Z2WZqt1+Tm/cn/Q==
"@formatjs/icu-messageformat-parser@2.7.3":
version "2.7.3"
resolved "https://registry.yarnpkg.com/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.7.3.tgz#c8c95e7c9f8141bdb93bea0e92e4fcace19d3c9f"
integrity sha512-X/jy10V9S/vW+qlplqhMUxR8wErQ0mmIYSq4mrjpjDl9mbuGcCILcI1SUYkL5nlM4PJqpc0KOS0bFkkJNPxYRw==
dependencies:
"@formatjs/ecma402-abstract" "1.17.2"
"@formatjs/icu-skeleton-parser" "1.6.2"
"@formatjs/ecma402-abstract" "1.18.0"
"@formatjs/icu-skeleton-parser" "1.7.0"
tslib "^2.4.0"
"@formatjs/icu-skeleton-parser@1.3.6":
@ -1408,30 +1408,30 @@
"@formatjs/ecma402-abstract" "1.11.4"
tslib "^2.1.0"
"@formatjs/icu-skeleton-parser@1.6.2":
version "1.6.2"
resolved "https://registry.yarnpkg.com/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.6.2.tgz#00303034dc08583973c8aa67b96534c49c0bad8d"
integrity sha512-VtB9Slo4ZL6QgtDFJ8Injvscf0xiDd4bIV93SOJTBjUF4xe2nAWOoSjLEtqIG+hlIs1sNrVKAaFo3nuTI4r5ZA==
"@formatjs/icu-skeleton-parser@1.7.0":
version "1.7.0"
resolved "https://registry.yarnpkg.com/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.7.0.tgz#796938d6d0ba8fc75bb9edee038d1350bfee32cb"
integrity sha512-Cfdo/fgbZzpN/jlN/ptQVe0lRHora+8ezrEeg2RfrNjyp+YStwBy7cqDY8k5/z2LzXg6O0AdzAV91XS0zIWv+A==
dependencies:
"@formatjs/ecma402-abstract" "1.17.2"
"@formatjs/ecma402-abstract" "1.18.0"
tslib "^2.4.0"
"@formatjs/intl-displaynames@6.6.0":
version "6.6.0"
resolved "https://registry.yarnpkg.com/@formatjs/intl-displaynames/-/intl-displaynames-6.6.0.tgz#6f590784b1bcdc1b96d4dba158bdce350f876804"
integrity sha512-bskUou9boZOzTqI8JdNCNkDavXf8uWWz/6NG1og/XJKpn4zsfiLdQ9EYKhVe/CfbCjlSyieJYn7/NztdoprHjw==
"@formatjs/intl-displaynames@6.6.4":
version "6.6.4"
resolved "https://registry.yarnpkg.com/@formatjs/intl-displaynames/-/intl-displaynames-6.6.4.tgz#dd9ca9bb2d1f4b140cc8814667bc830802621674"
integrity sha512-ET8KQ+L9Q0K8x1SnJQa4DNssUcbATlMopWqYvGGR8yAvw5qwAQc1fv+DshCoZNIE9pbcue0IGC4kWNAkWqlFag==
dependencies:
"@formatjs/ecma402-abstract" "1.17.2"
"@formatjs/intl-localematcher" "0.4.2"
"@formatjs/ecma402-abstract" "1.18.0"
"@formatjs/intl-localematcher" "0.5.2"
tslib "^2.4.0"
"@formatjs/intl-listformat@7.5.0":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@formatjs/intl-listformat/-/intl-listformat-7.5.0.tgz#dbccf2e0f07792aa1c273702796bdad061dc27ae"
integrity sha512-n9FsXGl1T2ZbX6wSyrzCDJHrbJR0YJ9ZNsAqUvHXfbY3nsOmGnSTf5+bkuIp1Xiywu7m1X1Pfm/Ngp/yK1H84A==
"@formatjs/intl-listformat@7.5.3":
version "7.5.3"
resolved "https://registry.yarnpkg.com/@formatjs/intl-listformat/-/intl-listformat-7.5.3.tgz#c6f028471839cd1014760498f783fdfe011422d5"
integrity sha512-l7EOr0Yh1m8KagytukB90yw81uyzrM7amKFrgxXqphz4KeSIL0KPa68lPsdtZ+JmQB73GaDQRwLOwUKFZ1VZPQ==
dependencies:
"@formatjs/ecma402-abstract" "1.17.2"
"@formatjs/intl-localematcher" "0.4.2"
"@formatjs/ecma402-abstract" "1.18.0"
"@formatjs/intl-localematcher" "0.5.2"
tslib "^2.4.0"
"@formatjs/intl-localematcher@0.2.25":
@ -1441,10 +1441,10 @@
dependencies:
tslib "^2.1.0"
"@formatjs/intl-localematcher@0.4.2":
version "0.4.2"
resolved "https://registry.yarnpkg.com/@formatjs/intl-localematcher/-/intl-localematcher-0.4.2.tgz#7e6e596dbaf2f0c5a7c22da5a01d5c55f4c37e9a"
integrity sha512-BGdtJFmaNJy5An/Zan4OId/yR9Ih1OojFjcduX/xOvq798OgWSyDtd6Qd5jqJXwJs1ipe4Fxu9+cshic5Ox2tA==
"@formatjs/intl-localematcher@0.5.2":
version "0.5.2"
resolved "https://registry.yarnpkg.com/@formatjs/intl-localematcher/-/intl-localematcher-0.5.2.tgz#5fcf029fd218905575e5080fa33facdcb623d532"
integrity sha512-txaaE2fiBMagLrR4jYhxzFO6wEdEG4TPMqrzBAcbr4HFUYzH/YC+lg6OIzKCHm8WgDdyQevxbAAV1OgcXctuGw==
dependencies:
tslib "^2.4.0"
@ -1456,17 +1456,17 @@
"@formatjs/ecma402-abstract" "1.4.0"
tslib "^2.0.1"
"@formatjs/intl@2.9.4":
version "2.9.4"
resolved "https://registry.yarnpkg.com/@formatjs/intl/-/intl-2.9.4.tgz#6f97a8e6e282086c39c8e502face5b2839f47b6f"
integrity sha512-hY0UlbDz8jY12RkQtkzxe3OfUmsIcUcsvVYyr1TFue6oTrUHqpkmYLdQ626V3BCSLc90EZDXdvmsPfMd3hTcYQ==
"@formatjs/intl@2.9.9":
version "2.9.9"
resolved "https://registry.yarnpkg.com/@formatjs/intl/-/intl-2.9.9.tgz#866629b565e20dd7490f9e77ee41a00748913e8f"
integrity sha512-JI3CNgL2Zdg5lv9ncT2sYKqbAj2RGrCbdzaCckIxMPxn4QuHuOVvYUGmBAXVusBmfG/0sxLmMrnwnBioz+QKdA==
dependencies:
"@formatjs/ecma402-abstract" "1.17.2"
"@formatjs/ecma402-abstract" "1.18.0"
"@formatjs/fast-memoize" "2.2.0"
"@formatjs/icu-messageformat-parser" "2.7.0"
"@formatjs/intl-displaynames" "6.6.0"
"@formatjs/intl-listformat" "7.5.0"
intl-messageformat "10.5.4"
"@formatjs/icu-messageformat-parser" "2.7.3"
"@formatjs/intl-displaynames" "6.6.4"
"@formatjs/intl-listformat" "7.5.3"
intl-messageformat "10.5.8"
tslib "^2.4.0"
"@formatjs/ts-transformer@3.9.4":
@ -5169,14 +5169,14 @@ intl-messageformat-parser@^5.3.7:
dependencies:
"@formatjs/intl-numberformat" "^5.5.2"
intl-messageformat@10.5.4:
version "10.5.4"
resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-10.5.4.tgz#7b212b083f1b354d7e282518e78057e025134af9"
integrity sha512-z+hrFdiJ/heRYlzegrdFYqU1m/KOMOVMqNilIArj+PbsuU8TNE7v4TWdQgSoxlxbT4AcZH3Op3/Fu15QTp+W1w==
intl-messageformat@10.5.8:
version "10.5.8"
resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-10.5.8.tgz#7184da425f360a53a5483a6194e16d666b011fc0"
integrity sha512-NRf0jpBWV0vd671G5b06wNofAN8tp7WWDogMZyaU8GUAsmbouyvgwmFJI7zLjfAMpm3zK+vSwRP3jzaoIcMbaA==
dependencies:
"@formatjs/ecma402-abstract" "1.17.2"
"@formatjs/ecma402-abstract" "1.18.0"
"@formatjs/fast-memoize" "2.2.0"
"@formatjs/icu-messageformat-parser" "2.7.0"
"@formatjs/icu-messageformat-parser" "2.7.3"
tslib "^2.4.0"
ioredis@^5.3.2:
@ -7510,20 +7510,20 @@ react-hook-form@^7.34.2:
resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.47.0.tgz#a42f07266bd297ddf1f914f08f4b5f9783262f31"
integrity sha512-F/TroLjTICipmHeFlMrLtNLceO2xr1jU3CyiNla5zdwsGUGu2UOxxR4UyJgLlhMwLW/Wzp4cpJ7CPfgJIeKdSg==
react-intl@^6.4.7:
version "6.5.0"
resolved "https://registry.yarnpkg.com/react-intl/-/react-intl-6.5.0.tgz#0ff04170f91e1bcbcd3301dfb2ae39a258827ec7"
integrity sha512-ZnBYFlFUU1ivhvWBA87XJLAr9nR8yeC1/83e6AL7yiHbWH7xQE7tyMyIyw6or78EvU9Hx8Sh8LUDC4bGrNxXOA==
react-intl@^6.5.5:
version "6.5.5"
resolved "https://registry.yarnpkg.com/react-intl/-/react-intl-6.5.5.tgz#d2de7bfd79718a7e3d8031e2599e94e0c8638377"
integrity sha512-cI5UKvBh4tc1zxLIziHBYGMX3dhYWDEFlvUDVN6NfT2i96zTXz/zH2AmM8+2waqgOhwkFUzd+7kK1G9q7fiC2g==
dependencies:
"@formatjs/ecma402-abstract" "1.17.2"
"@formatjs/icu-messageformat-parser" "2.7.0"
"@formatjs/intl" "2.9.4"
"@formatjs/intl-displaynames" "6.6.0"
"@formatjs/intl-listformat" "7.5.0"
"@formatjs/ecma402-abstract" "1.18.0"
"@formatjs/icu-messageformat-parser" "2.7.3"
"@formatjs/intl" "2.9.9"
"@formatjs/intl-displaynames" "6.6.4"
"@formatjs/intl-listformat" "7.5.3"
"@types/hoist-non-react-statics" "^3.3.1"
"@types/react" "16 || 17 || 18"
hoist-non-react-statics "^3.3.2"
intl-messageformat "10.5.4"
intl-messageformat "10.5.8"
tslib "^2.4.0"
react-is@^16.13.1, react-is@^16.7.0: