Tfjs: [tfjs-node-gpu] node_modules/typescript/lib/lib.dom.d.ts:15340:11 - error TS2430: Interface 'WebGLRenderingContext' incorrectly extends interface 'WebGLRenderingContextBase'.

Created on 19 Oct 2018  路  6Comments  路  Source: tensorflow/tfjs

TensorFlow.js version

@tensorflow/tfjs-node-gpu 0.1.1

Browser version

node v9.9.0, npm 6.2.0

Describe the problem or feature request

I just freshly installed tfjs-node-gpu on windows 10. Now I copy-pasted the "get started" code and tried to transpile it with typescript (tsconfig below). The project has no other dependencies.

Error message:

node_modules/typescript/lib/lib.dom.d.ts:15340:11 - error TS2430: Interface 'WebGLRenderingContext' incorrectly extends interface 'WebGLRenderingContextBase'.
  Types of property 'getExtension' are incompatible.
    Type '{ (name: "ANGLE_instanced_arrays"): ANGLEInstancedArrays; (name: "EXT_blend_minmax"): EXTBlendMinMax; (name: "EXT_color_buffer_half_float"): EXTColorBufferHalfFloat; (name: "EXT_frag_depth"): EXTFragDepth; (name: "EXT_sRGB"): EXTsRGB; (name: "EXT_shader_
texture_lod"): EXTShaderTextureLOD; (name: "EXT_texture_filter_...' is not assignable to type '{ (extensionName: "EXT_blend_minmax"): EXT_blend_minmax; (extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic; (extensionName: "EXT_frag_dep
th"): EXT_frag_depth; (extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod; (extensionName: "EXT_sRGB"): EXT_sRGB; (extensionName: "OES...'.
      Types of parameters 'name' and 'extensionName' are incompatible.
        Type '"OES_vertex_array_object"' is not assignable to type '"ANGLE_instanced_arrays"'.

15340 interface WebGLRenderingContext extends WebGLRenderingContextBase {
                ~~~~~~~~~~~~~~~~~~~~~

Code to reproduce the bug / link to feature request

index.ts:

import * as tf from '@tensorflow/tfjs';
import '@tensorflow/tfjs-node-gpu';

const shape = [2, 3];
const t = tf.tensor([1.0, 2.0, 3.0, 4.0, 5.5, 60.0], shape);
console.log(t);

tsconfig.json:

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "sourceMap": true
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ]
}

package.json:

{
  "name": "js",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "@tensorflow/tfjs-node-gpu": "0.1.19"
  },
  "devDependencies": {
    "typescript": "^3.1.3"
  },
  "scripts": {
    "compile": "tsc",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}


package-lock.json:
It's quite spammy, heres a paste: https://pastebin.com/raw/nEiz26f7

Most helpful comment

For now I just use the --skipLibCheck option in tsc.

All 6 comments

Looks like a problem with TypeScript or your definitions. Can you try updating those packages or posting your package.json?

Looks like a problem with TypeScript or your definitions. Can you try updating those packages or posting your package.json?

I updated the issue.

https://stackoverflow.com/questions/52846622/error-ts2430-interface-webglrenderingcontext-incorrectly-extends-interface-w

Try that

Now I get a new Error:
````
tsc

node_modules/@tensorflow/tfjs-core/dist/kernels/webgl/gpgpu_context.d.ts:15:27 - error TS2304: Cannot find name 'WebGLLoseContext'.

15 loseContextExtension: WebGLLoseContext;
~~~~

```

For now I just use the --skipLibCheck option in tsc.

I confirm that "skipLibCheck": true in tsconfig.json works fine !

Was this page helpful?
0 / 5 - 0 ratings