In this article we will learn about some of the frequently asked TypeScript programming questions in technical like “error TS2307: Cannot find module ‘path’ or its corresponding type declarations.” Code Answer’s. When creating scripts and web applications, error handling is an important part. If your code lacks error checking code, your program may look very unprofessional and you may be open to security risks. Error or stack handling on typescript was simple and easy. An error message with filename, line number and a message describing the error is sent to the browser. This tutorial contains some of the most common error checking methods in Typescript. Below are some solution about “error TS2307: Cannot find module ‘path’ or its corresponding type declarations.” Code Answer’s.
error TS2307: Cannot find module ‘path’ or its corresponding type declarations.
xxxxxxxxxx
go to 'tsconfig.app.json' and add "node" to types:
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": ["node"] <------------ ADD "node" HERE
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
cannot find module ‘path’ or its corresponding type declarations
xxxxxxxxxx
npm i @types/node -D