ICU types

This commit is contained in:
Fedor Indutny
2024-03-04 10:03:11 -08:00
committed by GitHub
parent 38adef4233
commit 78f4e96297
42 changed files with 583 additions and 1182 deletions

View File

@@ -4,6 +4,10 @@
import type { IntlShape } from 'react-intl';
import type { AciString } from './ServiceId';
import type { LocaleDirection } from '../../app/locale';
import type {
ICUJSXMessageParamsByKeyType,
ICUStringMessageParamsByKeyType,
} from '../../build/ICUMessageParams.d';
import type { HourCyclePreference, LocaleMessagesType } from './I18N';
@@ -17,12 +21,15 @@ export type RenderTextCallbackType = (options: {
key: number;
}) => JSX.Element | string;
export type ReplacementValuesType = {
[key: string]: string | number | undefined;
};
export { ICUJSXMessageParamsByKeyType, ICUStringMessageParamsByKeyType };
export type LocalizerType = {
(key: string, values?: ReplacementValuesType): string;
<Key extends keyof ICUStringMessageParamsByKeyType>(
key: Key,
...values: ICUStringMessageParamsByKeyType[Key] extends undefined
? [undefined?]
: [ICUStringMessageParamsByKeyType[Key]]
): string;
getIntl(): IntlShape;
getLocale(): string;
getLocaleMessages(): LocaleMessagesType;