Skip to content

Add Typescript type helpers #2344

@astralarya

Description

@astralarya

🚀 Feature Proposal

Enable strong type checking of translations in monorepos with multiple i18next instances.

Create a template type i18nInstance<CustomTypeOptions>, which would accept the CustomTypeOptions declaration as a type parameter. This would allow annotating i18next instances from createInstance() with different resources.

Motivation

Strong type-checking in monorepos currently does not allow packages to have independent translation resources.

The method described here (https://www.i18next.com/overview/typescript) does not allow defining different resources for different packages in the monorepo.

Example

In a monorepo, you could have two packages, each with their own locale resources and their own i18next instance. This would allow cleaner isolation between these two packages and enable strongly type checking the translation keys in each package.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions