Closed SaddamMohsen closed 3 months ago
We had similar experience to this and put some comments on #375 (seems similar) on a way we achieved it, but would be great if it was baked into the library.
This is a TypeScript thing: you have to add as const
to your links
variable to infer the types:
const links = [
{ name: "home", href: `/` },
{
name: "invoice",
href: `/invoice`
},
{ name: "users", href: `/users` },
] as const;
This is a TypeScript thing: you have to add
as const
to yourlinks
variable to infer the types:const links = [ { name: "home", href: `/` }, { name: "invoice", href: `/invoice` }, { name: "users", href: `/users` }, ] as const;
this way not working and keep give me error
Could you share a minimal reproduction? The issue is because link.name
's type is string
instead of 'invoice' | 'users'
, so as const
should fix it.
Could you share a minimal reproduction? The issue is because
link.name
's type isstring
instead of'invoice' | 'users'
, soas const
should fix it.
as const does not fix the problem so i use this solution temporarily https://github.com/QuiiBz/next-international/issues/375
Happy to help more if you can provide a minimal reproduction, because as const
should fix the issue.
Happy to help more if you can provide a minimal reproduction, because
as const
should fix the issue.
sorry what you mean by minimal reproduction
temp solution
scopedT(text as any)
suppose that i have this links
and this is the translation file for ar.ts
and this translation for en en.ts
what i need i need to apply this map and get the name of translation dynamically
when i do this it give me error No overload matches this call. how to do that