i18next / i18next-icu

i18nFormat plugin to use ICU format with i18next
MIT License
81 stars 17 forks source link

i18next used in index.d.ts but missing in dependency #45

Closed m1heng closed 1 year ago

m1heng commented 3 years ago

🐛 Bug Report

When using pnpm in project, ICU instance's type will be imcompatible with i18next.use

To Reproduce

use pnpm to install dependencies.

import i18next from 'i18next';
import ICU from 'i18next-icu';

const icu = new ICU();

// ts error on blow 'icu'
i18next.use(icu).init();

Type 'IcuInstance<IcuConfig>' provides no match for the signature 'new (...args: any[]): Module'.ts(2345)

as pnpm will not hoist all dependencies to root's node_modules. i18next-icu will not have access to i18next unless dependency was declared in package.json.

Possible solution

add i18next as dependency in package.json

link to pnpm issue https://github.com/pnpm/pnpm/discussions/3788

adrai commented 3 years ago

@pedrodurek can you check this?

pedrodurek commented 3 years ago

I didn't manage to replicate the issue on a codesandbox, so I'll try locally