Closed Valentin-MF closed 11 months ago
Have the same error, do we have a solution?
While waiting for a correction I don't use the types from the library anymore.
How can I do it as well?
While waiting for a correction I don't use the types from the library anymore.
From where you take your imports?
It depends on your project. I use angular so I added the standalone scripts in the scripts section of angular.json and in the typescript I don't import anything from the library, I just use globalThis.vis.
Like this:
angular.json:
...
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"scripts": [
"./node_modules/vis-data/standalone/umd/vis-data.min.js",
"./node_modules/vis-util/standalone/umd/vis-util.min.js",
"./node_modules/vis-timeline/standalone/umd/vis-timeline-graph2d.min.js"
]
},
...
Usage in my angular component:
let timeline = new globalThis.vis.Timeline(...)
Cool, I am using Angular too, just made the upgrade and got this errors. Could you explain me please how do you declare vis inside globalThis?
Nothing to do. It's done in the standalone version.
Hi Valentin-MF, can u show ur typings/global.d.ts ? it's will help me a lot.
I don't have global.d.ts
You may need to remove noImplicitAny in your tsconfig.json.
I have also changed code not to use the typings now and importing raw .js, but in my opinion, it's not the best solution.
It would be great if this gets in somehow, just typing update is needed I believe.
Another possible workaround is to add:
"skipLibCheck": true,
to your tsconfig.json
But this would apply it for every lib, I really wouldn't like that.
Any workarounds?
Since the latest version of vis-util (https://github.com/visjs/vis-util/releases/tag/v5.0.6) and after adding the @egjs/hammerjs
package (2.0.17) to my devDependencies
, my typescript compilation no longer encounters errors.
I import vis-data and vis-timeline into a typescript application. Since I upgraded Typescript from 4.7.x to 4.8.x, I get this error: