-
-
Notifications
You must be signed in to change notification settings - Fork 188
Add @types/tmp to dependencies #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Not including it in devDeps means that `strict: true` TSC projects
using mongoms currently fail to compile with:
```
node_modules/mongodb-memory-server-core/lib/MongoMemoryServer.d.ts:3:22 - error TS7016:
Could not find a declaration file for module 'tmp'.
'node_modules/mongodb-memory-server-core/node_modules/tmp/lib/tmp.js' implicitly has an 'any' type.
Try `npm install @types/tmp` if it exists or add a new declaration (.d.ts) file containing `declare module 'tmp';`
3 import * as tmp from 'tmp';
~~~~~
```
Codecov Report
@@ Coverage Diff @@
## master #266 +/- ##
=======================================
Coverage 80.75% 80.75%
=======================================
Files 9 9
Lines 764 764
Branches 144 144
=======================================
Hits 617 617
Misses 146 146
Partials 1 1Continue to review full report at Codecov.
|
@BigForNothing I think you're right, as it's used by library code exposed to consumers like my project. And oh, now I understand: I edited the wrong file; this is a monorepo and I should touch code in |
|
@hasezoey @nodkz I pushed a new fix; ready for review. Coming back to discussion in #265, I think @BigForNothing is right and @nodkz is missing the point. @nodkz , you say:
To the best of my current knowledge, this is incorrect if you aim at being usable by
Consequently, by putting the types in I stumbled on the same problem at work, and my policy is now:
For example, here's the project I'm working on; see how prod types are with prod libs in deps, and same for test types with test libs: "devDependencies": {
"@types/jest": "24.x",
"@types/supertest": "2.x",
"@typescript-eslint/eslint-plugin": "2.x",
"@typescript-eslint/parser": "2.x",
"eslint": "6.x",
"eslint-config-prettier": "6.x",
"eslint-plugin-prettier": "3.x",
"jest": "25.x",
"jest-junit": "10.x",
"mongodb-memory-server": "6.x",
"npm-audit-resolver": "2.x",
"prettier": "1.x",
"supertest": "4.x",
"typescript": "3.x"
},
"dependencies": {
"@types/body-parser": "1.x",
"@types/express": "4.x",
"@types/mongoose": "5.x",
"@types/node": "10.x",
"@types/request-promise": "4.x",
"body-parser": "1.x",
"express": "4.x",
"mongoose": "5.x",
"request-promise": "4.x",
"source-map-support": "0.x"
}Kinda sure about all that, but I welcome Daniel's take, maybe I'm missing something 🙂. |
|
@ronjouch i would like to not be involved in this discussion for this project, because i dont know what would be the right solution, and in its current state is the only thing i know and always done like it anyway, my take was always something like "if it isnt included (/needed) after the compilation, dont put it in normal dependencies" (and it always worked, but i didnt have many projects in strict mode, because of the nature of these projects) |
@hasezoey okay, leaving you out of it, and continuing the chat with @nodkz. @nodkz , what I'm suggesting is that I did fiddle with that quite a bit at work, and I think I know the correct solution to satisfy
Correct! The gotcha here is that, for Now, one may argue that Does that makes sense / am I missing something? Thanks for mongoms. |
|
@ronjouch Well said! I could be wrong, but I believe --isolatedModules require it too. All of our projects at work require the strict: true setting, and I've never had a personal project without it. |
|
@types/tmp should be in |
|
@ronjouch thanks for PR and the detailed explanation of |
Not including it in devDeps means that
strict: trueTSC projectsusing mongoms currently fail to compile with: