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(react-intl): fix d.ts rollup #1741

Merged
merged 1 commit into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"test": "yarn run prettier:check && lerna run test"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.7.13",
"@microsoft/api-extractor": "^7.8.12",
"@rollup/plugin-json": "^4.0.3",
"@types/jest": "^25.2.1",
"@typescript-eslint/eslint-plugin": "^2.29.0",
Expand Down
8 changes: 6 additions & 2 deletions packages/intl-numberformat/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ import {names as numberingSystemNames} from './data/numbering-systems.json';
import formatToParts from './format_to_parts';
// eslint-disable-next-line import/no-cycle
import getInternalSlots from './get_internal_slots';
import {NumberFormatConstructor, NumberFormatOptions} from './types';
import {
NumberFormatConstructor,
NumberFormatOptions,
NumberFormat as NumberFormatType,
} from './types';
import type {getCanonicalLocales} from '@formatjs/intl-getcanonicallocales';

// Merge declaration with the constructor defined below.
export type NumberFormat = import('./types').NumberFormat;
export type NumberFormat = NumberFormatType;

const VALID_NUMBERING_SYSTEM_NAMES = new Set(numberingSystemNames);

Expand Down
3 changes: 1 addition & 2 deletions packages/react-intl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@
],
"devDependencies": {
"@formatjs/intl-pluralrules": "^2.2.9",
"@microsoft/api-documenter": "^7.7.18",
"@microsoft/api-extractor": "^7.7.13",
"@microsoft/api-documenter": "^7.8.14",
"@types/benchmark": "^1.0.31",
"@types/enzyme": "^3.10.5",
"@types/jest": "^25.2.1",
Expand Down
8 changes: 6 additions & 2 deletions packages/react-intl/src/components/plural.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ FormattedPlural.defaultProps = {

FormattedPlural.displayName = 'FormattedPlural';

export default withIntl(FormattedPlural) as React.FC<WithIntlProps<Props>> & {
// Explicitly annotate type here to workaround API extractor's inability to handle `import('./someModule')`
// type annotations when rolling up DTS file.
const FormattedPluralWithIntl: React.FC<WithIntlProps<Props>> & {
WrappedComponent: React.ComponentType<Props>;
};
} = withIntl(FormattedPlural);

export default FormattedPluralWithIntl;
21 changes: 14 additions & 7 deletions packages/react-intl/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
createFormattedComponent,
createFormattedDateTimePartsComponent,
} from './components/createFormattedComponent';
import {CustomFormatConfig} from './types';
import {CustomFormatConfig, FormatDateOptions} from './types';
import {NumberFormatOptions} from '@formatjs/intl-numberformat';
import {IntlListFormatOptions} from '@formatjs/intl-listformat';
import {DisplayNamesOptions} from '@formatjs/intl-displaynames/lib';
Expand Down Expand Up @@ -58,12 +58,19 @@ export const FormattedDisplayName: React.FC<
value: string | number | object;
}
> = createFormattedComponent('formatDisplayName');
export const FormattedDateParts = createFormattedDateTimePartsComponent(
'formatDate'
);
export const FormattedTimeParts = createFormattedDateTimePartsComponent(
'formatTime'
);
export const FormattedDateParts: React.FC<
FormatDateOptions & {
value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
}
> = createFormattedDateTimePartsComponent('formatDate');
export const FormattedTimeParts: React.FC<
FormatDateOptions & {
value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
}
> = createFormattedDateTimePartsComponent('formatTime');

export {FormattedNumberParts} from './components/createFormattedComponent';
export {default as FormattedRelativeTime} from './components/relative';
export {default as FormattedPlural} from './components/plural';
Expand Down
79 changes: 36 additions & 43 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2209,39 +2209,39 @@
resolved "https://registry.yarnpkg.com/@mdx-js/util/-/util-1.6.1.tgz#c1e8480844dfaeecde8b827d0e4bbf8793274659"
integrity sha512-A3TBBjg5iVo8S4TTG0VrW8G9YNLob4+M6rALKjY8Sxr9zPExWQ7iTPUSvJVE7YhF9E08EQMubx1vRal3jtpJ9Q==

"@microsoft/api-documenter@^7.7.18":
version "7.8.0"
resolved "https://registry.yarnpkg.com/@microsoft/api-documenter/-/api-documenter-7.8.0.tgz#92816329eb4286bf284b92e31bcbed05b8bd5195"
integrity sha512-PZuOlS+b5LfCUOQ2iI32dl9xFcXine4Yu9xrb1w3LCwqYUxWU3K/tbwTatleOVPVDD6ZrH5XaddnGPyng2SrmA==
"@microsoft/api-documenter@^7.8.14":
version "7.8.14"
resolved "https://registry.yarnpkg.com/@microsoft/api-documenter/-/api-documenter-7.8.14.tgz#bcedaa07a598ee02cf84579b6b8f24108219c908"
integrity sha512-QlLV1MXRehAz16Mp+OW1bKHLVfVIki/fHDtfkiwzOVJP2r1wMVNc4Uast2wcHIyqfcYOIZuvGadF+1YW+PT44g==
dependencies:
"@microsoft/api-extractor-model" "7.8.0"
"@microsoft/api-extractor-model" "7.8.8"
"@microsoft/tsdoc" "0.12.19"
"@rushstack/node-core-library" "3.19.7"
"@rushstack/ts-command-line" "4.3.14"
"@rushstack/node-core-library" "3.24.1"
"@rushstack/ts-command-line" "4.4.2"
colors "~1.2.1"
js-yaml "~3.13.1"
resolve "1.8.1"
resolve "~1.17.0"

"@microsoft/api-extractor-model@7.8.0":
version "7.8.0"
resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.8.0.tgz#5f532998f01109f23d57b422803bbdf5ad655d80"
integrity sha512-rk3n2GJ2DyKsmKmSK0VYN92ZAWPgc5+zBLbGASpty3pBZBuByJ0ioZdkxbtm5gaeurJzsG9DFTPCmpg/+Mt/nw==
"@microsoft/api-extractor-model@7.8.8":
version "7.8.8"
resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.8.8.tgz#4ba1974c9b1e2d6b65daf56f6149c88d0a784680"
integrity sha512-oiUkYZmBUUd1afxkOXDgdaz/ROnNQT72xHE1ALHJzlCUWnAhQcWjVUOr9WnigIOJp1fiwfA6F2l1wUgDzFQ6Iw==
dependencies:
"@microsoft/tsdoc" "0.12.19"
"@rushstack/node-core-library" "3.19.7"
"@rushstack/node-core-library" "3.24.1"

"@microsoft/api-extractor@^7.7.13":
version "7.8.0"
resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.8.0.tgz#fea68e4f21c1bf18020560fd5728b15fe44f0976"
integrity sha512-H9dI7dCw005XuGa1dPAdZLQWEUu+B4yiF2v7NZ3p70mKo2iAZcd9LwmDTZ5OFALsNiHnJk1I5JZjcsj8dtB73g==
"@microsoft/api-extractor@^7.8.12":
version "7.8.12"
resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.8.12.tgz#dc04530f2bbbe63b644bd253e153e95b05b12033"
integrity sha512-tXJAlJCZ96Offii+4QelYOYbESc5az7MeJ34+EnluE1Exx0ksCsuZuKuyOBWqEandnEJ8tT3eMs8b/bvjH/2QA==
dependencies:
"@microsoft/api-extractor-model" "7.8.0"
"@microsoft/api-extractor-model" "7.8.8"
"@microsoft/tsdoc" "0.12.19"
"@rushstack/node-core-library" "3.19.7"
"@rushstack/ts-command-line" "4.3.14"
"@rushstack/node-core-library" "3.24.1"
"@rushstack/ts-command-line" "4.4.2"
colors "~1.2.1"
lodash "~4.17.15"
resolve "1.8.1"
resolve "~1.17.0"
source-map "~0.6.1"
typescript "~3.7.2"

Expand Down Expand Up @@ -2458,10 +2458,10 @@
estree-walker "^1.0.1"
picomatch "^2.2.2"

"@rushstack/node-core-library@3.19.7":
version "3.19.7"
resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.19.7.tgz#8d8a193fd6f99536c92dd797ab50fd5fcb7630ea"
integrity sha512-gKE/OXH5GAj8yJ1kEyRW68UekJernilZ3QTRgmQ0MUHBCQmtZ9Q6T5PQ1sVbcL4teH8BMdpZeFy1DKnHs8h3PA==
"@rushstack/node-core-library@3.24.1":
version "3.24.1"
resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.24.1.tgz#4da7d59e9555c633f4cfdd4e4f097e5348891eb7"
integrity sha512-A21eDQwXAD9bZnvJZIEIhD171EQEWWo2afRs0sSUJ5FpMFpoDwx5DOY4hDE7dnczSKRmKsiDBV8hTSKhJrsw/A==
dependencies:
"@types/node" "10.17.13"
colors "~1.2.1"
Expand All @@ -2471,12 +2471,12 @@
timsort "~0.3.0"
z-schema "~3.18.3"

"@rushstack/ts-command-line@4.3.14":
version "4.3.14"
resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.3.14.tgz#5d7a437d4e9c564ff1b8e876215fca96c74858a1"
integrity sha512-YJZIyKvkm3f6ZdKSfMntHS9542Y2mmMWzaiPPoXxLFZntKxEIDE3WfUNlvOSo3yK4fNd09Tz3hfvTivQNHSiKQ==
"@rushstack/ts-command-line@4.4.2":
version "4.4.2"
resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.4.2.tgz#8e2518b41045ba91275c2bfc872ec9cdaa074adf"
integrity sha512-iJ6wV+ICaE252J2snVPDiX4pz1r25CY1Ua/3QE4nd+lD+80hv6i6JLCDdmkculgYRXkAxvYXRtriD4JfqvgdKA==
dependencies:
"@types/argparse" "1.0.33"
"@types/argparse" "1.0.38"
argparse "~1.0.9"
colors "~1.2.1"

Expand All @@ -2492,10 +2492,10 @@
resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a"
integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==

"@types/argparse@1.0.33":
version "1.0.33"
resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.33.tgz#2728669427cdd74a99e53c9f457ca2866a37c52d"
integrity sha512-VQgHxyPMTj3hIlq9SY1mctqx+Jj8kpQfoLvDlVSDNOyuYs8JYfkuY3OW/4+dO657yPmNhHpePRx0/Tje5ImNVQ==
"@types/argparse@1.0.38":
version "1.0.38"
resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9"
integrity sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==

"@types/babel__core@^7.1.7":
version "7.1.7"
Expand Down Expand Up @@ -11813,7 +11813,7 @@ path-key@^3.0.0, path-key@^3.1.0:
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==

path-parse@^1.0.5, path-parse@^1.0.6:
path-parse@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
Expand Down Expand Up @@ -13738,14 +13738,7 @@ resolve@1.15.1:
dependencies:
path-parse "^1.0.6"

resolve@1.8.1:
version "1.8.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26"
integrity sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==
dependencies:
path-parse "^1.0.5"

resolve@^1.1.5, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.8.1:
resolve@^1.1.5, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.8.1, resolve@~1.17.0:
version "1.17.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444"
integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==
Expand Down