aurelia/i18n

I18N.tr has wrong options overload type

rmja opened this issue · 0 comments

rmja commented

I'm submitting a bug report

  • Library Version:
    4.0.3

Please tell us about your environment:

  • Operating System:
    any

  • Node Version:
    16.14.2

  • NPM Version:
    8.7.0
  • JSPM OR Webpack AND Version
    webpack 5
  • Browser:
    all

  • Language:
    TypeScript 4.2

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:

  • What is the expected behavior?
    That one can call i18n.tr() with an interpolation map.

  • What is the motivation / use case for changing the behavior?