cacheable icon indicating copy to clipboard operation
cacheable copied to clipboard

Could not find a declaration file for module 'http-cache-semantics'

Open Maxim-Mazurok opened this issue 3 years ago • 1 comments
trafficstars

Describe the bug When using [email protected] in my TypeScript project, I get the following error when trying to compile it:

maxim@ubuntu:~/google-api-typings-generator$ tsc
node_modules/cacheable-request/dist/types.d.ts:7:35 - error TS7016: Could not find a declaration file for module 'http-cache-semantics'. '/home/maxim/google-api-typings-generator/node_modules/http-cache-semantics/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/http-cache-semantics` if it exists or add a new declaration (.d.ts) file containing `declare module 'http-cache-semantics';`

7 import { CachePolicyObject } from 'http-cache-semantics';
                                    ~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/cacheable-request/dist/types.d.ts:7

How To Reproduce (best to provide workable code or tests!) The problem is currently present in this PR: https://github.com/Maxim-Mazurok/google-api-typings-generator/pull/709

  1. git clone -b create-pr-action/chore-npm-dedupe-0 https://github.com/Maxim-Mazurok/google-api-typings-generator
  2. cd google-api-typings-generator
  3. optional nvm i
  4. npm ci
  5. Observe the error

Maxim-Mazurok avatar Sep 25 '22 11:09 Maxim-Mazurok

@Maxim-Mazurok - thanks for sending this over. I was looking at the node_modules/cacheable-request/dist/package.json and we do have @types/http-cache-semantics in there but seems to not be loading in the node_modules.

When I run npm i --save-dev @types/http-cache-semantics on the main project this goes away but there seems to be an issue.

jaredwray avatar Sep 25 '22 16:09 jaredwray

@Maxim-Mazurok - published release 10.2.1 with your changes. Thanks so much for contributing 🎉

https://github.com/jaredwray/cacheable-request/releases/tag/v10.2.1

jaredwray avatar Sep 26 '22 14:09 jaredwray