mirror of
https://github.com/flarum/core.git
synced 2025-08-11 02:44:04 +02:00
fix: return Mithril.Children
in translator outputs
This avoids having `NestedStringArray` in generated dist typings which can make it hard to override content with null.
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
declare module '@askvortsov/rich-icu-message-formatter' {
|
declare module '@askvortsov/rich-icu-message-formatter' {
|
||||||
|
import Mithril from 'mithril';
|
||||||
|
|
||||||
type IValues = Record<string, any>;
|
type IValues = Record<string, any>;
|
||||||
|
|
||||||
type ITypeHandler = (
|
type ITypeHandler = (
|
||||||
@@ -10,16 +12,13 @@ declare module '@askvortsov/rich-icu-message-formatter' {
|
|||||||
) => string;
|
) => string;
|
||||||
type IRichHandler = (tag: any, values: IValues, contents: string) => any;
|
type IRichHandler = (tag: any, values: IValues, contents: string) => any;
|
||||||
|
|
||||||
type ValueOrArray<T> = T | ValueOrArray<T>[];
|
|
||||||
type NestedStringArray = ValueOrArray<string>;
|
|
||||||
|
|
||||||
export class RichMessageFormatter {
|
export class RichMessageFormatter {
|
||||||
locale: string | null;
|
locale: string | null;
|
||||||
constructor(locale: string | null, typeHandlers: Record<string, ITypeHandler>, richHandler: IRichHandler);
|
constructor(locale: string | null, typeHandlers: Record<string, ITypeHandler>, richHandler: IRichHandler);
|
||||||
|
|
||||||
format(message: string, values: IValues): string;
|
format(message: string, values: IValues): string;
|
||||||
process(message: string, values: IValues): NestedStringArray;
|
process(message: string, values: IValues): Mithril.Children;
|
||||||
rich(message: string, values: IValues): NestedStringArray;
|
rich(message: string, values: IValues): Mithril.Children;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mithrilRichHandler(tag: any, values: IValues, contents: string): any;
|
export function mithrilRichHandler(tag: any, values: IValues, contents: string): any;
|
||||||
|
Reference in New Issue
Block a user