Skip to content

feat: improve tsconfig#33

Merged
hugop95 merged 7 commits intomainfrom
main-tsconfig
Mar 19, 2026
Merged

feat: improve tsconfig#33
hugop95 merged 7 commits intomainfrom
main-tsconfig

Conversation

@hugop95
Copy link
Contributor

@hugop95 hugop95 commented Mar 19, 2026

This PR simply strengthen typings by improving the tsconfig configuration, and fixing related errors.

Changes

Added in this PR:

  • allowUnreachableCode: false
  • allowUnusedLabels: false
  • noImplicitAny: true (was false)
  • noImplicitThis: true (was false)
  • strict: true
  • useUnknownInCatchVariables: true
  • skipLibCheck: true

Removed:

  • strictNullChecks: false (now covered by strict: true)

@hugop95 hugop95 self-assigned this Mar 19, 2026
hugop95 added 4 commits March 19, 2026 15:49
- 👉 Fix simple cases.
- ⏳ Add missing test types.
- ⏳ Fix missing semver typing.
- ✅ Fix simple cases.
- 👉 Add missing test types.
- ⏳ Fix missing semver typing.
Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

hugop95 added 2 commits March 19, 2026 15:51
- ✅ Fix simple cases.
- ✅ Add missing test types.
- 👉 Fix missing semver typing.
  - An alternative to `"skipLibCheck": true` would have been to install types for `semver`.
- We can probably do something simpler by checking if the error is an instance of `MongoServerError`, but I prefer not to introduce this runtime change here for safety.
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"skipLibCheck": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reviewers

❓ What is the error?

node_modules/mongodb-memory-server-core/lib/util/utils.d.ts:10:25 - error TS7016: Could not find a declaration file for module 'semver'. '/Users/hugo.prunaux/Desktop/dev/work/mongo-bulk-data-migration/node_modules/semver/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/semver` if it exists or add a new declaration (.d.ts) file containing `declare module 'semver';`

10 import * as semver from 'semver';
                           ~~~~~~~~


Found 1 error in node_modules/mongodb-memory-server-core/lib/util/utils.d.ts:10

@hugop95 hugop95 requested a review from Copilot March 19, 2026 14:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens TypeScript type-checking via tsconfig updates and resolves the resulting type errors across core migration logic and test utilities.

Changes:

  • Enable stricter TypeScript compiler options (strict, noImplicit*, etc.) and adjust configuration accordingly.
  • Fix/adjust typings in source and test utility code to satisfy stricter compilation.
  • Update MongoDB test helper usage (db.command) and add global typings for test runtime globals.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsconfig.json Adds stricter compiler options and restructures type-checking config.
src/tools/arrayFilters.ts Tightens typings for arrayFilters and adjusts regex match handling.
src/testUtils/doRollbackAndAssertForInitialState.ts Adds explicit typings for shared test helpers.
src/MongoBulkDataMigration.ts Makes catch-block error narrowing compatible with stricter TS settings.
src/lib/computeRollbackQuery.ts Narrows type of unsetAdditionalPositional for stricter checking.
src/lib/AbstractBulkOperationResults.ts Refactors bulk re-initialization to satisfy stricter initialization/typing.
testsUtils/mongoValidation.ts Switches to Db.command() in test utility.
testsUtils/globals.d.ts Declares typed global variables used by tests.
tests/MongoBulkDataMigration.update.test.ts Fixes update variable typing to reflect actual function shape.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hugop95 hugop95 marked this pull request as ready for review March 19, 2026 14:57
@hugop95 hugop95 requested a review from pp0rtal as a code owner March 19, 2026 14:57
Copy link
Contributor

@pp0rtal pp0rtal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hugop95 Thank you!! 🚀
It should have been strict since the project was created 🙌

@hugop95 hugop95 merged commit d0726fd into main Mar 19, 2026
8 checks passed
@hugop95 hugop95 deleted the main-tsconfig branch March 19, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants