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

better typescript support #243

Open
schiller-manuel opened this issue Dec 7, 2023 · 0 comments
Open

better typescript support #243

schiller-manuel opened this issue Dec 7, 2023 · 0 comments

Comments

@schiller-manuel
Copy link

Currently @shopify/i18next-shopify does not have dedicated typescript support.
This results in typescript errors e.g. when using its custom pluralization with nested keys and using a declaration file as explained in https://www.i18next.com/overview/typescript#create-a-declaration-file

Example

i18n resource

"variants": {
      "one": "{{count}} variant",
      "other": "{{count}} variants"
}

usage

 <Text variant="bodySm" as="p" tone="subdued">
    {t('variants', {
      count: 1,
    })}
</Text>

typescript error

Argument of type '["variants", { count: number; }]' is not assignable to parameter of type '[key: "change" | "select" | "variants.one" | "variants.other" | TemplateStringsArray | ("change" | "select" | "variants.one" | "variants.other" | TemplateStringsArray)[], options?: ({ ...; } & InterpolationMap<...>) | undefined] | [key: ...] | [key: ...]'.
  Type '["variants", { count: number; }]' is not assignable to type '[key: string | string[], defaultValue: string, options?: ({ count: number; } & $Dictionary) | undefined]'.
    Type at position 1 in source is not compatible with type at position 1 in target.
      Type '{ count: number; }' is not assignable to type 'string'.ts(2345)
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

No branches or pull requests

1 participant