benawad / typescript-yarn-workspace-example

86 stars 34 forks source link

Unable to compile typescript : Could not find a declaration file for module 'rate-limit-redis' #2

Closed doctorniz closed 6 years ago

doctorniz commented 6 years ago

To replicate this problem

git clone ... .

Performed ncu -a

I am on Windows so edited package.json scripts to begin with cross-env

yarn add cross-env

Then tried

yarn start

to receive the following error:

C:\Users\doc\OneDrive\Projects\training\benawad\typeorm\node_modules\ts-node\src\index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: Ô¿» Unable to compile TypeScript:
src/startServer.ts(7,38): error TS7016: Could not find a declaration file for module 'rate-limit-redis'. 'C:/Users/doc/OneDrive/Projects/training/benawad/typeorm/node_modules/rate-limit-redis/lib/redis-store.js' implicitly has an 'any' type.
  Try 'npm install @types/rate-limit-redis' if it exists or add a new declaration (.d.ts) file containing "declare module 'rate-limit-redis'";

    at createTSError (C:\Users\doc\OneDrive\Projects\training\benawad\typeorm\node_modules\ts-node\src\index.ts:261:12)
    at getOutput (C:\Users\doc\OneDrive\Projects\training\benawad\typeorm\node_modules\ts-node\src\index.ts:367:40)
    at Object.compile (C:\Users\doc\OneDrive\Projects\training\benawad\typeorm\node_modules\ts-node\src\index.ts:557:11)
    at Module.m._compile (C:\Users\doc\OneDrive\Projects\training\benawad\typeorm\node_modules\ts-node\src\index.ts:439:43)
    at Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\Users\doc\OneDrive\Projects\training\benawad\typeorm\node_modules\ts-node\src\index.ts:442:12)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
[nodemon] app crashed - waiting for file changes before starting...

Please advise. I was getting compiling/linting errors whilst following the YouTube playlist so thought I would download this and work backwards but am still having difficulties with TypeScript.

benawad commented 6 years ago

This repo doesn't use rate-limit-redis why is it complaining about the types for it?

doctorniz commented 6 years ago

Sorry. My bad, I posted on the wrong git