mirror of
https://github.com/flarum/core.git
synced 2025-08-08 01:16:52 +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' {
|
||||
import Mithril from 'mithril';
|
||||
|
||||
type IValues = Record<string, any>;
|
||||
|
||||
type ITypeHandler = (
|
||||
@@ -10,16 +12,13 @@ declare module '@askvortsov/rich-icu-message-formatter' {
|
||||
) => string;
|
||||
type IRichHandler = (tag: any, values: IValues, contents: string) => any;
|
||||
|
||||
type ValueOrArray<T> = T | ValueOrArray<T>[];
|
||||
type NestedStringArray = ValueOrArray<string>;
|
||||
|
||||
export class RichMessageFormatter {
|
||||
locale: string | null;
|
||||
constructor(locale: string | null, typeHandlers: Record<string, ITypeHandler>, richHandler: IRichHandler);
|
||||
|
||||
format(message: string, values: IValues): string;
|
||||
process(message: string, values: IValues): NestedStringArray;
|
||||
rich(message: string, values: IValues): NestedStringArray;
|
||||
process(message: string, values: IValues): Mithril.Children;
|
||||
rich(message: string, values: IValues): Mithril.Children;
|
||||
}
|
||||
|
||||
export function mithrilRichHandler(tag: any, values: IValues, contents: string): any;
|
||||
|
Reference in New Issue
Block a user