msaebi031 / i18n-telegraf

MIT License
1 stars 0 forks source link

TS, ES6 #2

Open wolterlife opened 1 year ago

wolterlife commented 1 year ago

Is it work with TypeScript and ES6 modules? Because receive D:/Main/telegrambot/node_modules/i18n-telegraf/lib/index.d.ts' is not a module

msaebi031 commented 11 months ago

it work es6

applehawk commented 9 months ago

Is it work with TypeScript and ES6 modules? Because receive D:/Main/telegrambot/node_modules/i18n-telegraf/lib/index.d.ts' is not a module

Need change name of module "telegraf-i18n" to "i18n-telegraf" inside file /node_modules/i18n-telegraf/lib/index.d.ts.

But mot helpful solution it rename an NPM package in your package.json use this : https://gist.github.com/nandorojo/1b969a0d88cf81ca8a2a334a5bd2ee4a

So it can be look: "dependencies": { "dotenv": "^16.3.2", "telegraf-i18n": "npm:i18n-telegraf@^8.6.9", "path": "^0.12.7", "telegraf": "^4.15.3", "telegraf-session-local": "^2.1.1" },

Next construction inside package.json...: "telegraf-i18n": "npm:i18n-telegraf@^8.6.9",

...will create after 'npm install' in node_module package folder with name telegraf-i18n, so it will be correspond to module name telegraf-i18n inside /node_modules/i18n-telegraf/lib/index.d.ts

It will fix error TS2306: File '.../node_modules/i18n-telegraf/lib/index.d.ts' is not a module.

declare module 'i18n-telegraf' {
    interface Config {
        directory?: string;
        useSession?: boolean;
        sessionName?: string;
        allowMissing?: boolean;
        defaultLanguageOnMissing?: boolean;
        defaultLanguage?: string;
    }