Danfo-JS conflict with typescript types

124 views Asked by At

I'm trying to compile a typescript code which uses danfojs-node.

My package.json looks like this:

{
  "dependencies": {
    "danfojs-node": "^1.1.2",
    "typescript": "^5.2.2"
  }
}

My tsconfig.json is:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "declaration": true,
    "outDir": "./dist",
    "strict": true
  },
  "include": [
    "src"
  ],
  "exclude": [
    "node_modules",
    "**/__tests__/*"
  ],
  "skipLibCheck": true
}

When I run tsc to compile the typescript, I get the following errors:

../../.nvm/versions/node/v18.17.0/lib/node_modules/typescript/lib/lib.dom.d.ts:23073:11 - error TS2430: Interface 'WebGL2RenderingContext' incorrectly extends interface 'WebGL2RenderingContextBase'.
  Types of property 'READ_BUFFER' are incompatible.
    Type 'number' is not assignable to type '3074'.

23073 interface WebGL2RenderingContext extends WebGL2RenderingContextBase, WebGL2RenderingContextOverloads, WebGLRenderingContextBase {
                ~~~~~~~~~~~~~~~~~~~~~~

../node_modules/@types/webgl-ext/index.d.ts:53:11 - error TS2717: Subsequent property declarations must have the same type.  Property 'RGBA16F_EXT' must be of type '34842', but here has type 'number'.

53  readonly RGBA16F_EXT: number;
             ~~~~~~~~~~~

  ../../.nvm/versions/node/v18.17.0/lib/node_modules/typescript/lib/lib.dom.d.ts:7477:14
    7477     readonly RGBA16F_EXT: 0x881A;
                      ~~~~~~~~~~~
    'RGBA16F_EXT' was also declared here.

../node_modules/@types/webgl-ext/index.d.ts:54:11 - error TS2717: Subsequent property declarations must have the same type.  Property 'RGB16F_EXT' must be of type '34843', but here has type 'number'.

54  readonly RGB16F_EXT: number;
             ~~~~~~~~~~

  ../../.nvm/versions/node/v18.17.0/lib/node_modules/typescript/lib/lib.dom.d.ts:7478:14
    7478     readonly RGB16F_EXT: 0x881B;
                      ~~~~~~~~~~
    'RGB16F_EXT' was also declared here.

../node_modules/@types/webgl-ext/index.d.ts:55:11 - error TS2717: Subsequent property declarations must have the same type.  Property 'FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT' must be of type '33297', but here has type 'number'.

55  readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: number;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  ../../.nvm/versions/node/v18.17.0/lib/node_modules/typescript/lib/lib.dom.d.ts:7479:14
    7479     readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: 0x8211;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT' was also declared here.

../node_modules/@types/webgl-ext/index.d.ts:56:11 - error TS2717: Subsequent property declarations must have the same type.  Property 'UNSIGNED_NORMALIZED_EXT' must be of type '35863', but here has type 'number'.

56  readonly UNSIGNED_NORMALIZED_EXT: number;
             ~~~~~~~~~~~~~~~~~~~~~~~

  ../../.nvm/versions/node/v18.17.0/lib/node_modules/typescript/lib/lib.dom.d.ts:7480:14
    7480     readonly UNSIGNED_NORMALIZED_EXT: 0x8C17;
                      ~~~~~~~~~~~~~~~~~~~~~~~
    'UNSIGNED_NORMALIZED_EXT' was also declared here.

../node_modules/@types/webgl-ext/index.d.ts:74:11 - error TS2717: Subsequent property declarations must have the same type.  Property 'COMPRESSED_RGB_ETC1_WEBGL' must be of type '36196', but here has type 'number'.

74  readonly COMPRESSED_RGB_ETC1_WEBGL: number;
             ~~~~~~~~~~~~~~~~~~~~~~~~~

  ../../.nvm/versions/node/v18.17.0/lib/node_modules/typescript/lib/lib.dom.d.ts:22895:14
    22895     readonly COMPRESSED_RGB_ETC1_WEBGL: 0x8D64;
                       ~~~~~~~~~~~~~~~~~~~~~~~~~
    'COMPRESSED_RGB_ETC1_WEBGL' was also declared here.

../node_modules/@types/webgl2/index.d.ts:582:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'WebGL2RenderingContext' must be of type '{ new (): WebGL2RenderingContext; prototype: WebGL2RenderingContext; readonly READ_BUFFER: 3074; readonly UNPACK_ROW_LENGTH: 3314; ... 556 more ...; readonly BROWSER_DEFAULT_WEBGL: 37444; }', but here has type '{ new (): WebGL2RenderingContext; prototype: WebGL2RenderingContext; readonly ACTIVE_ATTRIBUTES: number; readonly ACTIVE_TEXTURE: number; ... 556 more ...; readonly MAX_CLIENT_WAIT_TIMEOUT_WEBGL: number; }'.

582 declare var WebGL2RenderingContext: {
                ~~~~~~~~~~~~~~~~~~~~~~

  ../../.nvm/versions/node/v18.17.0/lib/node_modules/typescript/lib/lib.dom.d.ts:23076:13
    23076 declare var WebGL2RenderingContext: {
                      ~~~~~~~~~~~~~~~~~~~~~~
    'WebGL2RenderingContext' was also declared here.


Found 7 errors in 3 files.

Errors  Files
     1  ../../.nvm/versions/node/v18.17.0/lib/node_modules/typescript/lib/lib.dom.d.ts:23073
     5  ../node_modules/@types/webgl-ext/index.d.ts:53
     1  ../node_modules/@types/webgl2/index.d.ts:582

I found this https://github.com/tensorflow/tfjs/issues/818 which may be related, but is an old issue that should be now solved.

0

There are 0 answers