Comparing version 4.0.0-beta-7b755e9 to 4.0.0-beta-8cce53e
@@ -8,12 +8,15 @@ import type { ReactNode } from 'react'; | ||
import type { MessageKeys, NamespaceKeys, NestedKeyOf, NestedValueOf } from './MessageKeys.tsx'; | ||
import type { ICUArg, MarkupTagsFunction, RichTagsFunction } from './TranslationValues.tsx'; | ||
import type { MarkupTagsFunction, RichTagsFunction, TranslationValues } from './TranslationValues.tsx'; | ||
import { type Formatters, type IntlCache } from './formatters.tsx'; | ||
import type { Prettify } from './types.tsx'; | ||
type ICUArgsWithTags<MessageString extends string, TagsFn extends RichTagsFunction | MarkupTagsFunction = never> = ICUArgs<MessageString, { | ||
ICUArgument: string | number | boolean | Date; | ||
ICUArgument: string; | ||
ICUNumberArgument: number; | ||
ICUDateArgument: Date | number; | ||
ICUDateArgument: Date; | ||
}> & ([TagsFn] extends [never] ? {} : ICUTags<MessageString, TagsFn>); | ||
type OnlyOptional<T> = Partial<T> extends T ? true : false; | ||
type TranslateArgs<Value extends string, TagsFn extends RichTagsFunction | MarkupTagsFunction = never> = string extends Value ? [values?: Record<string, ICUArg | TagsFn>, formats?: Formats] : (Value extends any ? (key: ICUArgsWithTags<Value, TagsFn>) => void : never) extends (key: infer Args) => void ? OnlyOptional<Args> extends true ? [values?: undefined, formats?: Formats] : [values: Prettify<Args>, formats?: Formats] : never; | ||
type TranslateArgs<Value extends string, TagsFn extends RichTagsFunction | MarkupTagsFunction = never> = string extends Value ? [ | ||
values?: Record<string, TranslationValues[string] | TagsFn>, | ||
formats?: Formats | ||
] : (Value extends any ? (key: ICUArgsWithTags<Value, TagsFn>) => void : never) extends (key: infer Args) => void ? OnlyOptional<Args> extends true ? [values?: undefined, formats?: Formats] : [values: Prettify<Args>, formats?: Formats] : never; | ||
type NamespacedMessageKeys<TranslatorMessages extends Messages, Namespace extends NamespaceKeys<TranslatorMessages, NestedKeyOf<TranslatorMessages>> = never> = MessageKeys<NestedValueOf<{ | ||
@@ -20,0 +23,0 @@ '!': TranslatorMessages; |
export type { default as AbstractIntlMessages } from './AbstractIntlMessages.tsx'; | ||
export type { TranslationValues, ICUArg, RichTranslationValues, MarkupTranslationValues, RichTagsFunction, MarkupTagsFunction } from './TranslationValues.tsx'; | ||
export type { TranslationValues, RichTranslationValues, MarkupTranslationValues, RichTagsFunction, MarkupTagsFunction } from './TranslationValues.tsx'; | ||
export type { default as Formats } from './Formats.tsx'; | ||
@@ -4,0 +4,0 @@ export type { default as IntlConfig } from './IntlConfig.tsx'; |
import type { ReactNode } from 'react'; | ||
export type ICUArg = string | number | boolean | Date; | ||
export type TranslationValues = Record<string, ICUArg>; | ||
export type TranslationValues = Record<string, string | number | Date>; | ||
export type RichTagsFunction = (chunks: ReactNode) => ReactNode; | ||
export type MarkupTagsFunction = (chunks: string) => string; | ||
export type RichTranslationValues = Record<string, ICUArg | RichTagsFunction>; | ||
export type MarkupTranslationValues = Record<string, ICUArg | MarkupTagsFunction>; | ||
export type RichTranslationValues = Record<string, TranslationValues[string] | RichTagsFunction>; | ||
export type MarkupTranslationValues = Record<string, TranslationValues[string] | MarkupTagsFunction>; |
{ | ||
"name": "use-intl", | ||
"version": "4.0.0-beta-7b755e9", | ||
"version": "4.0.0-beta-8cce53e", | ||
"sideEffects": false, | ||
@@ -67,3 +67,3 @@ "author": "Jan Amann <jan@amann.work>", | ||
}, | ||
"gitHead": "ff4d528b0becc2d1c27232ea8f53351ff655cc50" | ||
"gitHead": "1d8e497bf88194490b9fe8e61b8d69cc69bde205" | ||
} |
1468
82918