planttheidea/moize

Dependency micro-memoize 4.0.12 cause TS erros

Closed this issue · 2 comments

Hi,
I just today installed new project without npm lockfile and building failed for moize with TypeScript errors

node_modules/.pnpm/moize@6.1.1/node_modules/moize/index.d.ts:16:21 - error TS2314: Generic type 'Cache' requires 1 type argument(s). 16 export type Cache = MicroMemoize.Cache; node_modules/.pnpm/moize@6.1.1/node_modules/moize/index.d.ts:17:35 - error TS2314: Generic type 'Options' requires 1 type argument(s). 17 export type MicroMemoizeOptions = MicroMemoize.Options;

I dug deeper as we use moize without problems elsewhere and found out that in that new generated lock file peer dependency micro-memoize is resolved with version 4.0.12 which is 5 days old new version in NPM a there were changes in typings files which cause these errors.

So I went with workaround and edited manually our lock file to use again 4.0.11 and it works.

Could this be fixed so we do not need to manually update lockfiles? Thank You!

Ah, apologies there. I'll update micro-memoize to have a default value (which should avoid this issue for fresh installs on latest dependency version) and then also update moize to better support the pass-through that micro-memoize has.

This should be resolved if you re-initialize your yarn.lock (as the latest micro-memoize should no longer have this issue), but also the recently-published 6.1.4 version of moize should have this fix plus improved pass-through typing. Hope this resolves your issue, but if you have any other issues let me know!