visjs / vis-data

🗄️ Manage unstructured data using DataSet. Add, update, and remove data, and listen for changes in the data.

Home Page:https://visjs.github.io/vis-data/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript compile error in data-interface.ts

icsaszar opened this issue · comments

I'm trying to use this along with vis-network for a project with typescript, but I keep getting the following error:

export type DeepPartial<T> = T extends any[] | Function | Node

node_modules/vis-data/declarations/data-interface.d.ts:33:67 - error TS2304: Cannot find name 'Node'.

33 export declare type DeepPartial<T> = T extends any[] | Function | Node ? T : T extends object ? {
                                                                     ~~~~

Removing Node seems to fix the issue, but I'm not sure if it won't break something else.

My guess is that you don't have DOM types installed. Node is the parent type of HTMLElement etc. Removing it would break some type checking (it would no longer be required to be a valid Node, HTMLElement and so on).

You're right, I used vis-data in a vscode extension and it doesn't import dom by default.

Thanks for the help.

I'll leave a link to a stackoverflow answer in case anyone else runs into this.