Description
Hello, I'm trying to use TSCC to compile typescript code that depends on Tensorflow JS. TFJS has nice type declaration files in its NPM package, and these are structured like this:
node_modules/
@tensorflow/
tfjs/dist/index.d.ts <-- This exports all the symbols from the other directories
tfjs-backend-webgl/dist/*.d.ts
tfjs-core/dist/*.d.ts
...
To use this in my code, I have an import: import * as tf from '@tensorflow/tfjs';
My tsconfig.json includes all the typescript .d.ts files, eg:
"compilerOptions": {
"moduleResolution": "node",
...
},
"include": [
"myscripts/**/*.ts",
"node_modules/@tensorflow/tfjs/dist/*.d.ts",
"node_modules/@tensorflow/tfjs-backend-webgl/dist/*.d.ts",
...
]
My tscc.spec.json looks like this:
{
"modules": {
"out": {
"entry": "myscripts/app.ts"
}
},
"external": {
"@tensorflow/tfjs": "tf"
}
}
However, when I try to compile this with TSCC, I get this error: Module name node_modules._tensorflow.tfjs_core.dist.base.d was not provided as a closure compilation source
I've tried enabling persistArtifacts
to look at the intermediate output, and the only tensorflow output I see is node_modules/@tensorflow/tfjs/dist/index.js
, which just contains:
goog.module('@tensorflow/tfjs')
/** Generated by TSCC */
exports = tf;
Shouldn't there be an externs.js file somewhere with the type information? How can I resolve this issue?