Polyconseil / vue-gettext

Translate your Vue.js applications with gettext.
MIT License
278 stars 55 forks source link

Module 'vue-gettext/types' has no exported member 'translate'. #116

Open evgeniyparanyuk-textmagic opened 4 years ago

evgeniyparanyuk-textmagic commented 4 years ago

dSN4CmR

evgeniyparanyuk-textmagic commented 4 years ago

I use typescript 3.9.5

Pavel-Son commented 4 years ago

+1, the same issue. Seems like simple d.ts could fix it

Thomas-1985 commented 1 year ago

+1 here, using typescript 4.7.3

annyanich commented 1 year ago

I believe that the following code snippet may help those of you who would like to add types for the exported member translate themselves in their own project. In ours, I created a file vue-gettext.d.ts with the following content:

declare module 'vue-gettext' {
    const translate: {
        getTranslation(msgid: any, n?: number, context?: any, defaultPlural?: any, language?: string): any;
        gettext(msgid: any, language?: string): any;
        pgettext(context: any, msgid: any, language?: string): any;
        ngettext(msgid: any, plural: any, n: any, language?: string): any;
        npgettext(context: any, msgid: any, plural: any, n: any, language?: string): any;
        initTranslations(translations: any, config: any): void;
        gettextInterpolate: any;
    }
}

There are a lot of 'any' types in there which should probably be replaced with more specific types. But I hope this is a useful scaffolding to help you or anyone reading this in the future get started.