AtoraSuunva / booru

Searches boorus for images using some js magic
https://www.npmjs.com/package/booru
MIT License
78 stars 19 forks source link

Could not find a declaration file for module 'node-fetch' #70

Closed sawa-ko closed 3 years ago

sawa-ko commented 3 years ago

Error


node_modules/booru/dist/Constants.d.ts:1:29 - error TS7016: Could not find a declaration file for module 'node-fetch'. '../node_modules/node-fetch/lib/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/node-fetch` if it exists or add a new declaration (.d.ts) file containing `declare module 'node-fetch';`

1 import { RequestInit } from 'node-fetch';



[17:32:57] Found 1 error. Watching for file changes.
```

> package.json
```json
{
  "devDependencies": {
     "@types/node-fetch": "^3.0.3"
  }
}
```
AtoraSuunva commented 3 years ago

Looks like node-fetch bundles typings now so @types/typescript doesn't have any types anymore

I'll update node-fetch and update the package, but if you need the fix now (or can't update booru) you can install the older (working) types package npm i --save-dev @types/node-fetch@2.5.12

AtoraSuunva commented 3 years ago

nevermind node-fetch changed to be ESM-only and that broke jest and some of my other tooling (see this issue)

i've published booru@2.4.2 with dependency updates, but you'll have to pin @types/node-fetch@2.5.12 yourself, if npm fails to install the right version

i'll likely move away from node-fetch in a later version if they don't add a non-ESM version, as moving to ESM might break a lot of things really badly for me