Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error TS2688: Cannot find type definition file for 'keyv'. For version 4.2.0 #528

Closed
nitish24p opened this issue Oct 19, 2022 · 22 comments
Closed

Comments

@nitish24p
Copy link

nitish24p commented Oct 19, 2022

Type definition missing for 4.2.0
One of my projects has a dependency on keyv, when the typescript compiler runs it finds that 4.2.0 doesnt have the index.d.ts file.
There was a publish made 16 hours ago post which builds for me have started failing.
https://registry.npmjs.org/@types/keyv mentions the versions installed, and the package to the tar file is https://registry.npmjs.org/@types/keyv/-/keyv-4.2.0.tgz

Either i can force resolution to a lower version or maybe you could push 4.2.0 with the index.d.ts file or mention a migration strategy.

Thanks

Steps To reproduce

  1. Clone https://github.com/software-mansion/react-native-screens
  2. npm install should fail

The failed message should say something around the line of bob build failed. This is caused by @react-native-community-package/bob, where it runs the tsc build command as mentioned on the bottom line and it will fail.

https://github.com/callstack/react-native-builder-bob/blob/v0.17.1/src/targets/typescript.ts#L130

@jaredwray
Copy link
Owner

@nitish24p - thanks and we are looking into this.

@jaredwray
Copy link
Owner

@nitish24p - one thing is that with the latest you should not be using the @types/keyv. have you tried removing it?

@nitish24p
Copy link
Author

Hi @jaredwray that will be my last option since i will have to go and make updates to all libraries on which keyv is dependant on. But will want to keep that option open too

@jaredwray
Copy link
Owner

Do you know what specific libraries are referencing the older versions? Happy to dig in with you to get them updated.

@nitish24p
Copy link
Author

nitish24p commented Oct 19, 2022

So i have

My App
|
react-native-screens@2.17.1 **Custom Forked Version**
└─┬ release-it@13.7.2
  └─┬ got@11.8.2
    └─┬ @types/cacheable-request@6.0.2
      └── @types/keyv@4.2.0

So react-native-screens basically does a build which calls the typescript compiler and that fails.

@jaredwray
Copy link
Owner

@nitish24p - we have seen this a bunch as cacheable-request is now at version 10 and got is on 12. Both of them are now ESM native. If you upgrade react-native-screens to the latest release-it v15.5.0 it should solve it.

@vasudevan242
Copy link

vasudevan242 commented Oct 19, 2022

Hi, i'm getting below error.
error TS2688: Cannot find type definition file for 'keyv'.
I'm not sure for which package this dependency exists.

@vasudevan242
Copy link

i tried installing npm i @types/keyv@3.1.4 there is index.d.ts file
image

but for latest changes npm i @types/keyv i don't see index.d.ts file
image

@samwi
Copy link

samwi commented Oct 19, 2022

Appears that Electron@latest via @electron/get@1.14.1 is using keyv@3.1.0

Might need to get Electron to update but it is broken for the time being

image

@jaredwray
Copy link
Owner

@samwi this looks pretty old. I also heard Electron is being deprecated correct?

@jaredwray
Copy link
Owner

jaredwray commented Oct 19, 2022

@samwi and @vasudevan242 - would recommend either getting them to upgrade or seeing if you can pull the file directly from Keyv (https://github.com/jaredwray/keyv/blob/main/packages/keyv/src/index.d.ts) as we have not used @types/xxx for a while. Looks like they turned it off?

Also, the version of GOT is very old and if you upgrade that all will work.

@azmicirit
Copy link

@jaredwray could you publish @types/keyv@4.2.0 back please? all serverless framework versions are using at least got@11.8.5.

├─┬ serverless@2.72.3
│ ├─┬ @serverless/cli@1.6.0
│ ├─┬ @serverless/components@3.18.2
│ │ ├── got@11.8.5 deduped
│ ├─┬ @serverless/utils@5.20.3
│ │ ├── got@11.8.5 deduped

even if I update serverless framework to v3, latest serverless also uses got@11.8.5. I believe the millions of project will be affected and not able to be running after this removal.

@azmicirit
Copy link

@jaredwray After I updated my node version from v14 to v16, I could get a build successfully. I guess node v14 doesn't support ESM module import.

@alphmt
Copy link
Contributor

alphmt commented Oct 21, 2022

@azmicirit It got removed in this issue: DefinitelyTyped/DefinitelyTyped#62793

Will this workaround mentioned in above issue works?

@nitish24p
Copy link
Author

I had to explicitly had keyv at 3.1.14 as dev dependencies for this to work at the moment.

@azmicirit
Copy link

@alphmth I did same thing what @nitish24p did and updated node.js version to v16 and then it just worked.
But also overrides all @types/keyv dependencies in package.json as well.

"overrides": {
    "@types/keyv": "3.1.4"
}

@mmcshinsky-bitgo
Copy link

mmcshinsky-bitgo commented Oct 21, 2022

Even overrides isn't really a solution. Suggestion to:

  • Un-deprecate @types/keyv: 4.2.0
  • Remove keyv: 4.5.0 and promote 4.5.0 to 5.0.0 as a breaking change due to the Node v14 issues.

@mesner
Copy link

mesner commented Oct 27, 2022

electron depends on electron/get, which is stuck on got@11 since got@12 only publishes ESM.
got@11 depends on the deprecated @types/cacheable-request, which has a dependency on @types/keyv@*, which grabs the latest (major) version of @types/keyv, which is v4.20 and doesn't include index.d.ts. This is the cause of the typescript error in this thread for me.

@jaredwray Would you please consider either deleting @types/keyv@4.2.0 and deprecating the prior version (@types/keyv@3.1.4) or publishing a new @types/keyv@4.2.1 that includes an index.d.ts file to not break typescript builds?

As an aside, I'd argue electron is the most active desktop ui framework and is definitely not deprecated. Take a look at its activity https://github.com/electron/electron/commits/main

@jaredwray jaredwray reopened this Oct 27, 2022
@jaredwray
Copy link
Owner

@mesner - We have re-opened this and looking at what it would take to re-publish to types to fill this gap.

kanadgupta added a commit to readmeio/rdme that referenced this issue Nov 3, 2022
This wasn't actually solving the TS issues we're seeing and we're going to have to wait until jaredwray/keyv#528 is resolved.
@jaredwray
Copy link
Owner

@kanadgupta @mesner @mmcshinsky-bitgo - merging and will release the changes in the next 48 hours.

@thorsent
Copy link

thorsent commented Nov 7, 2022

@jaredwray it doesn't look like @types/keyv got updated. npm is still pointing to 4.2.0 and missing index.d.ts:
https://www.npmjs.com/package/@types/keyv

@jaredwray
Copy link
Owner

@thorsent there is a discussion here on it: DefinitelyTyped/DefinitelyTyped#62793

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

No branches or pull requests

9 participants