Skip to content

TranslationFunction return type #191

Open
@afonsograca

Description

@afonsograca

👋 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!

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