Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Typescript Errors #500

Closed
gpresland opened this issue Oct 4, 2017 · 10 comments
Closed

Typescript Errors #500

gpresland opened this issue Oct 4, 2017 · 10 comments

Comments

@gpresland
Copy link

Attempting to use levelup with leveldown results in a screen full of type errors.

Installed with:

npm install --save levelup leveldown

and

npm install --save-dev @types/levelup @types/leveldown

When run with node_modules/.bin/tsc you get:

node_modules/@types/levelup/index.d.ts(76,20): error TS2694: Namespace '"node_modules/leveldown/leveldown"' has no exported member 'Constructor'.
node_modules/leveldown/leveldown.d.ts(66,3): error TS7010: 'seek', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(2,3): error TS7010: 'open', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(3,3): error TS7010: 'open', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(5,3): error TS7010: 'close', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(7,3): error TS7010: 'get', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(7,26): error TS7006: Parameter 'err' implicitly has an 'any' type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(8,3): error TS7010: 'get', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(8,39): error TS7006: Parameter 'err' implicitly has an 'any' type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(10,3): error TS7010: 'put', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(11,3): error TS7010: 'put', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(13,3): error TS7010: 'del', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(14,3): error TS7010: 'del', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(17,3): error TS7010: 'batch', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/leveldown/node_modules/abstract-leveldown/index.d.ts(18,3): error TS7010: 'batch', which lacks return-type annotation, implicitly has an 'any' return type.
@vweevers
Copy link
Member

vweevers commented Oct 4, 2017

We are actively working on improving the typings, they will be included in levelup itself. Stay tuned!

cc @MeirionHughes @zixia

@MeirionHughes
Copy link
Member

leveldown, memdown, encoding-leveldown come with their own types that are different and breaking to the defiantly typed ones. we're in the process of updating the typings for levelup too.

@huan
Copy link
Contributor

huan commented Oct 4, 2017

@gpresland I believe this issue will be solved after the levelup v2.0 package is published on NPM with the latest typings.

Before that, I suggest you try npm i [email protected], which is the only version with the right(almost) typings currently.

You can have a look at this TypeScript repository which has a workable levelup at:
https://github.com/zixia/flash-store/blob/31a8ab6f3ddd79a5a55b97ed868ad719d7cc5cd4/package.json#L36-L38

@earslap
Copy link

earslap commented Oct 21, 2017

Any updates on this issue? I believe the v2.0.0 is released on npm, and leveldown has their typings bundled but levelup has no d.ts files. The type declerations under definitelytyped are 6-7 months old so I don't know where I'm supposed to get the latest ones...

@huan
Copy link
Contributor

huan commented Oct 24, 2017

I have a workaround as the following combination:

    "encoding-down": "^2.3.1",
    "leveldown": "^2.0.0",
    "levelup": "github:MeirionHughes/levelup",

Then the typing system works.

@sqwk
Copy link

sqwk commented Dec 5, 2017

This hasn't made it into 2.0.1, has it?

@vweevers
Copy link
Member

vweevers commented Dec 5, 2017

Correct. You can follow #499 for progress.

@peternoyes
Copy link

peternoyes commented Jan 11, 2018

@zixia What types are using that works with the github version of levelup?

I am trying:
"@types/leveldown": "^1.7.0",
"@types/levelup": "0.0.30",

And still seeing errors

@huan
Copy link
Contributor

huan commented Feb 2, 2018

@peternoyes Please have a look at https://github.com/zixia/flash-store to get it work.

I use levelup with typing in that project.

@vweevers
Copy link
Member

Please see Level/community#16.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants