nbind icon indicating copy to clipboard operation
nbind copied to clipboard

npm i produces error "type-check is deprecated" and "Type 'string' cannot be used to index type 'ExportType'."

Open netpoetica opened this issue 4 years ago • 0 comments

After cloning, while npm installling, nbinid will produce the following errors with the following node/npm versions:

➜  nbind git:(master) ✗ node -v
v12.18.4
➜  nbind git:(master) ✗ npm -v
6.14.6
➜  nbind git:(master) npm i
....
> [email protected] lint /Users/rosenbek/github/nbind
> node src/checkver.js lt 10.0.0 || (tslint --type-check -c src/tslint.json -p src/tsconfig.json && tslint --type-check -c src/tslint.json -p src/em/tsconfig.json)

--type-check is deprecated. You only need --project to enable rules which need type information.
Error at src/nbind.ts:329:3: Type 'string' cannot be used to index type 'ExportType'.

I removed the --type-check flags from the package.json, which got me further, but then I get a new error:

➜  nbind git:(master) ✗ npm i 
...

> [email protected] lint /Users/rosenbek/github/nbind
> node src/checkver.js lt 10.0.0 || (tslint -c src/tslint.json -p src/tsconfig.json && tslint -c src/tslint.json -p src/em/tsconfig.json)

src/nbind.ts:329:3 - error TS2536: Type 'string' cannot be used to index type 'ExportType'.

329  	binding.lib[key] = lib[key];
     	~~~~~~~~~~~~~~~~


Found 1 error.

Which seems to come from this code:

	Object.keys(lib).forEach(function(key: string) {
		binding.lib[key] = lib[key];
	});

because key is a string, but binding.lib is expecting this ExportType object. I did try to fix this and hope to put together a PR, but I am a bit too new to nbind I think to produce a valid solution.

netpoetica avatar Nov 01 '20 18:11 netpoetica