benjamine / jsondiffpatch

Diff & patch JavaScript objects
MIT License
4.77k stars 464 forks source link

compile errors when not including dom types #323

Closed DetachHead closed 8 months ago

DetachHead commented 1 year ago
// tsconfig.json
{
    "compilerOptions": {
        "lib": ["es2021"],
        "skipLibCheck": false
    },
    "include": ["**/*.ts"]
}
// main.ts
import { diff } from 'jsondiffpatch'
node_modules/jsondiffpatch/dist/index.d.ts:12:41 - error TS2304: Cannot find name 'Element'.

12     showUnchanged(show: boolean, node?: Element | null, delay?: number): void;
                                           ~~~~~~~

node_modules/jsondiffpatch/dist/index.d.ts:19:26 - error TS2304: Cannot find name 'Element'.

19     hideUnchanged(node?: Element | null, delay?: number): void;
                            ~~~~~~~

since i'm using nodejs, i don't want dom types to be globaly available and i also don't want to have to suppress these errors with skipLibCheck.

upstream issue: https://github.com/microsoft/TypeScript/issues/50424