How to properly place @types/* packages: in dependencies or devDependencies?
Hello colleagues! I'm new to TypeScript and trying to understand the correct structure of package.json. I have a React + TypeScript project. I'm installing types for various libraries, for example, lodash, express, and react. I don't understand where to put them: in `dependencies` or `devDependencies`?\n\nHere's an example of my package.json:\n\n```json\n{\n "name": "my-app",\n "version": "1.0.0",\n "dependencies": {\n "react": "^18.2.0",\n "react-dom": "^18.2.0",\n "lodash": "^4.17.21",\n "@types/react": "^18.2.0",\n "@types/react-dom": "^18.2.0",\n "@types/lodash": "^4.14.182"\n },\n "devDependencies": {\n "typescript": "^5.0.0",\n "webpack": "^5.75.0"\n }\n}\n```\n\nI see that many people on the internet put @types/* in devDependencies, but I'm not sure why that is correct.
No answers yet.
Log in to leave an answer
Blogs