Skip to content

Type signature of translate is incorrect. #71

@jarkko

Description

@jarkko

The translate function is typed to always return a string, which is incorrect. In the case of a partial path, it will return an object instead, as seen here.

Thus, code that uses and expects that functionality will not even compile in Typescript because of a type mismatch.

Example:

setTranslations({ foo: "bar", baz: { foo: "bar" } })
const baz = t("baz") // returns { foo: "bar" }
Object.assign(baz, fallback: "") // will bomb because of the incorrect type signature of translate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions