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

TranslationFunction return type #191

Open
afonsograca opened this issue Sep 18, 2024 · 0 comments
Open

TranslationFunction return type #191

afonsograca opened this issue Sep 18, 2024 · 0 comments

Comments

@afonsograca
Copy link

👋 Hey there,

First off, thank you so much for this awesome project! I've been experimenting with it and really appreciate how cool and useful it is. 🙌

While using it in a TypeScript project with strict mode enabled, I encountered an issue. Specifically, whenever I use $i18n() inside a script tag or a .ts file, I get the following error:
Unsafe call of an 'any' typed value.

After some digging, I noticed that the TranslationFunction is currently defined as:

type TranslationFunction<P extends Parser.Params = Parser.Params> = (key: string, ...restParams: P) => any;

I was wondering if there are specific cases where the return type might need to be something other than a string. If not, do you think it would be possible to adjust the return type to avoid these TypeScript errors? I understand there may be more context I’m missing, so any guidance or clarification would be greatly appreciated!

Thanks again for the great work on this project. Looking forward to hearing your thoughts!

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