tfjs: Breaking Change v3.8.0 => v3.9.0

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows
  • TensorFlow.js installed from (npm or script link): npm
  • TensorFlow.js version (use command below): 3.9.0

Describe the current behavior

Upgraded from 3.8.0 to 3.9.0, and typescript throws an error:

Error: node_modules/@tensorflow/tfjs-core/dist/hash_util.d.ts:2:49 - error TS2304: Cannot find name ‘Long’.

image

Using typescript 4.3.5.

Perhaps missing import Long from 'long'; in image

Describe the expected behavior

No breaking change

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I am also having the same issue on a fresh Angular 12 install… Version is 3.11.0

When I manually add /// <reference types="long" /> to the hash_util.d.ts it works as expected.

Before

/// <amd-module name="@tensorflow/tfjs-core/dist/hash_util" />
export declare function hexToLong(hex: string): Long;
export declare function fingerPrint64(s: Uint8Array, len?: number): Long;

After

/// <amd-module name="@tensorflow/tfjs-core/dist/hash_util" />
/// <reference types="long" />
export declare function hexToLong(hex: string): Long;
export declare function fingerPrint64(s: Uint8Array, len?: number): Long;

v3.12.0

Added @types/long to my compilerOptions.types worked.

Step 1. npm I -D @types/long Step 2. go to tsconfig.app.json Step 3. add “types”: [“@types/long”]

----->tsconfig.app.json this file will looks like

{ “extends”: “./tsconfig.json”, “compilerOptions”: { “outDir”: “./out-tsc/app”,

“types”: [“@types/long”]

}, “files”: [ “src/main.ts”, “src/polyfills.ts” ], “include”: [ “src/**/*.d.ts” ] } -------> it worked for me, hope will work for you as well.