Skip to content

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

@netpoetica

Description

@netpoetica

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
....
> nbind@0.3.15 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 
...

> nbind@0.3.15 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions