-
Notifications
You must be signed in to change notification settings - Fork 84
chore(typescript): enable erasableSyntaxOnly for the whole repo #2601
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
There was a problem hiding this 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 enables the TypeScript erasableSyntaxOnly compiler option across the repository, which requires removing syntax that can't be cleanly erased during transpilation. The main changes involve converting TypeScript enums to const objects with string literal types, and adjusting constructor parameter properties to explicit assignments.
Key changes:
- Converting enums to const objects with
as constassertions and corresponding type definitions - Replacing constructor parameter properties (e.g.,
public config) with explicit property declarations and assignments - Updating all references to use string literals instead of enum values
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| configs/tsconfig-mongosh/tsconfig.common.json | Enables erasableSyntaxOnly compiler option |
| packages/shell-api/src/enums.ts | Converts ServerVersions and Topologies enums to const objects with type definitions |
| packages/shell-api/src/error-codes.ts | Converts ShellApiErrors enum to const object |
| packages/errors/src/common-errors.ts | Converts CommonErrors enum to const object |
| packages/cli-repl/src/error-codes.ts | Converts CliReplErrors enum to const object |
| packages/async-rewriter2/src/error-codes.ts | Converts AsyncRewriterErrors enum to const object |
| packages/node-runtime-worker-thread/src/serializer.ts | Converts SerializedResultTypes enum to union type and updates usages |
| packages/node-runtime-worker-thread/src/rpc.ts | Removes RPCMessageTypes enum and uses string literals directly |
| packages/build/src/config/platform.ts | Converts Platform enum to union type |
| packages/shell-api/src/shell-instance-state.ts | Updates topology assignments to use string literals |
| packages/shell-api/src/mongo.ts | Updates decorator calls to use string literal arrays |
| packages/shell-api/src/database.ts | Updates decorator calls to use string literal arrays |
| packages/shell-api/src/collection.ts | Updates decorator calls to use string literal arrays and removes unused import |
| packages/shell-api/src/integration.spec.ts | Updates test assertion to use string literal |
| packages/browser-runtime-core/src/autocompleter/shell-api-autocompleter.spec.ts | Updates test data to use string literal and removes unused import |
| packages/autocomplete/src/index.spec.ts | Updates test parameters to use string literals with const assertions |
| packages/logging/src/analytics-helpers.ts | Converts constructor parameter property to explicit declaration |
| packages/build/src/publish-mongosh.ts | Converts constructor parameter properties to explicit declarations |
| packages/build/src/homebrew/publish-to-homebrew.ts | Converts constructor parameter property to explicit declaration |
| packages/build/src/evergreen/rest-api.ts | Converts constructor parameter properties to explicit declarations |
| packages/build/src/config/config.ts | Updates platform type from string to NodeJS.Platform |
| packages/build/src/barque.ts | Updates platform comparison to use string literal and removes unused import |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gagik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! this reminds me I need to finalize mongodb-js/vscode#1175
Inspired by mongodb-js/compass#7613