tsconfig / bases

Hosts TSConfigs to extend in a TypeScript app, tuned to a particular runtime environment
MIT License
6.21k stars 231 forks source link

TS7016 issue with #261

Closed gordonwho closed 5 months ago

gordonwho commented 5 months ago

I am getting the following error when I tried to import helmet

 import helmet from 'helmet';

Below is the typescript error

Could not find a declaration file for module 'helmet'. 'c:/dev/GitHub/Scheduling/node_modules/helmet/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/helmet` if it exists or add a new declaration (.d.ts) file containing `declare module 'helmet';`ts(7016)

Below is my tsconfig file:

{
  "extends": "@tsconfig/node18/tsconfig.json",
  "compilerOptions": {
    "module": "commonjs",
    "target": "ES2022",
    "moduleResolution": "node",
    "outDir": "dist",
    "sourceMap": true,
    "lib": ["ES2022", "dom"],
    "types": [
      "node",
      "jest",
      "@types/jest",
      "@types/node",
      "@types/helmet",
      "@types/swagger-express-middleware",
      "@types/swagger-ui-express"
    ],
    "typeRoots": ["../node_modules/@types"],
    "strict": false,
    "allowJs": true,
    "noImplicitAny": false,
    "esModuleInterop": true,
    "skipLibCheck": false,
    "forceConsistentCasingInFileNames": false
  },
  "include": ["**/*.ts"],
  "exclude": ["node_modules"]
}

Configurations:

Tyepscript : 5.3.3 Nodejs: 18 How do I resolve the issue?

orta commented 5 months ago

This isn't an issue with this repo