aurelia / i18n

A plugin that provides i18n support.
MIT License
93 stars 70 forks source link

I18N.tr has wrong options overload type #352

Closed rmja closed 1 year ago

rmja commented 1 year ago

I'm submitting a bug report

Please tell us about your environment:

Current behavior: The current prototype of i18.tr() has this prototype:

tr<TResult extends string | object | Array<string | object> | undefined = string>(key: string | string[], options?: TOptions<object>): TResult;

It should instead have:

tr<TResult extends string | object | Array<string | object> | undefined = string>(key: string | string[], options?: TOptions): TResult;

where TOptions = TOptions<StringMap> by default so that one can use overloads such as:

this.i18n.tr(`key`, {
            some_interpolation_field: "some interpolated value",
        })

Expected/desired behavior: