UNPKG

1.34 kBTypeScriptView Raw
1import { FormatDateOptions, FormatDisplayNameOptions, FormatListOptions, FormatNumberOptions } from '@formatjs/intl';
2import * as React from 'react';
3import { IntlShape } from '../types';
4type Formatter = {
5 formatDate: FormatDateOptions;
6 formatTime: FormatDateOptions;
7 formatNumber: FormatNumberOptions;
8 formatList: FormatListOptions;
9 formatDisplayName: FormatDisplayNameOptions;
10};
11export declare const FormattedNumberParts: React.FC<Formatter['formatNumber'] & {
12 value: Parameters<IntlShape['formatNumber']>[0];
13 children(val: Intl.NumberFormatPart[]): React.ReactElement | null;
14}>;
15export declare const FormattedListParts: React.FC<Formatter['formatList'] & {
16 value: Parameters<IntlShape['formatList']>[0];
17 children(val: ReturnType<Intl.ListFormat['formatToParts']>): React.ReactElement | null;
18}>;
19export declare function createFormattedDateTimePartsComponent<Name extends 'formatDate' | 'formatTime'>(name: Name): React.FC<Formatter[Name] & {
20 value: Parameters<IntlShape[Name]>[0];
21 children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
22}>;
23export declare function createFormattedComponent<Name extends keyof Formatter>(name: Name): React.FC<Formatter[Name] & {
24 value: Parameters<IntlShape[Name]>[0];
25 children?(val: string): React.ReactElement | null;
26}>;
27export {};