From 222d9ccff7bead92d06cdfe8e45705d6573662f5 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Mon, 21 Mar 2022 00:32:56 -0400 Subject: [PATCH] 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. --- framework/core/js/src/@types/translator-icu-rich.d.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/framework/core/js/src/@types/translator-icu-rich.d.ts b/framework/core/js/src/@types/translator-icu-rich.d.ts index 08fb52765..a1cefb795 100644 --- a/framework/core/js/src/@types/translator-icu-rich.d.ts +++ b/framework/core/js/src/@types/translator-icu-rich.d.ts @@ -1,4 +1,6 @@ declare module '@askvortsov/rich-icu-message-formatter' { + import Mithril from 'mithril'; + type IValues = Record; 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 | ValueOrArray[]; - type NestedStringArray = ValueOrArray; - export class RichMessageFormatter { locale: string | null; constructor(locale: string | null, typeHandlers: Record, 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;