when compiling a web application in typescript using jsroot I get the following error:
Type error: Could not find a declaration file for module 'jsroot'. '/home/turra/physval-web/node_modules/jsroot/modules/main.mjs' implicitly has an 'any' type.
There are types at '/home/turra/physval-web/node_modules/jsroot/types.d.ts', but this result could not be resolved when respecting package.json "exports". The 'jsroot' library may need to update its package.json or typings.
1 | 'use client'
2 |
> 3 | import { openFile, isNodeJs, HierarchyPainter, draw } from 'jsroot';
| ^
So it seems that package.json has to be updated. I am not expert, but this change solve the issue:
14c14,18
< ".": "./modules/main.mjs",
---
> ".": {
> "import": "./modules/main.mjs",
> "require": "./build/jsroot.js",
> "types": "./types.d.ts"
> },
134a139
>