fix: 🐛 possible interpolation value types

This commit is contained in:
Christian Kaisermann 2020-11-07 11:31:11 -03:00
parent 6d768b9ae9
commit 0caaead478

View File

@ -1,4 +1,4 @@
import { Formats } from 'intl-messageformat'; import type { FormatXMLElementFn, Formats } from 'intl-messageformat';
export interface LocaleDictionary { export interface LocaleDictionary {
[key: string]: LocaleDictionary | string | Array<string | LocaleDictionary>; [key: string]: LocaleDictionary | string | Array<string | LocaleDictionary>;
@ -8,12 +8,25 @@ export type LocalesDictionary = {
[key: string]: LocaleDictionary; [key: string]: LocaleDictionary;
}; };
export type InterpolationValues =
| Record<
string,
| string
| number
| boolean
| Date
| FormatXMLElementFn<unknown>
| null
| undefined
>
| undefined;
export interface MessageObject { export interface MessageObject {
id?: string; id?: string;
locale?: string; locale?: string;
format?: string; format?: string;
default?: string; default?: string;
values?: Record<string, string | number | Date>; values?: InterpolationValues;
} }
export type MessageFormatter = ( export type MessageFormatter = (