Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I18N.tr has wrong options overload type #352

Closed
rmja opened this issue Oct 4, 2022 · 0 comments · Fixed by #356
Closed

I18N.tr has wrong options overload type #352

rmja opened this issue Oct 4, 2022 · 0 comments · Fixed by #356

Comments

@rmja
Copy link
Contributor

rmja commented Oct 4, 2022

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?

rmja added a commit to rmja/i18n that referenced this issue Oct 4, 2022
@zewa666 zewa666 closed this as completed in 46a8339 Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant