When using LWWMap via ESM import
import { LWWMap } from "y-lwwmap";
the types from the d.ts file are not respected, and typescript has the following warning:
Could not find a declaration file for module 'y-lwwmap'. 'node_modules/y-lwwmap/dist/LWWMap.esm.js' implicitly has an 'any' type.
There are types at 'node_modules/y-lwwmap/dist/LWWMap.d.ts', but this result could not be resolved when respecting package.json "exports". The 'y-lwwmap' library may need to update its package.json or typings.ts(7016)
Based on the issue in the ts compiler[0] - it looks like this can be resolved by creating a copy of the types file (.d.ts) that is named LWWMap.esm.d.ts and moving types down a level in package.json[1]
[0]microsoft/TypeScript#52363
[1]https://www.kravchyk.com/typescript-npm-package-json-exports/
When using LWWMap via ESM import
the types from the d.ts file are not respected, and typescript has the following warning:
Based on the issue in the ts compiler[0] - it looks like this can be resolved by creating a copy of the types file (.d.ts) that is named
LWWMap.esm.d.tsand movingtypesdown a level inpackage.json[1][0]microsoft/TypeScript#52363
[1]https://www.kravchyk.com/typescript-npm-package-json-exports/