-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
refactor(tests): replace @ts-ignore with @ts-expect-error for improved type safety #4826
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
base: master
Are you sure you want to change the base?
refactor(tests): replace @ts-ignore with @ts-expect-error for improved type safety #4826
Conversation
…d type safety Replace all 22 @ts-ignore directives with @ts-expect-error across 6 test files. Each replacement includes a descriptive comment explaining the intentional type violation being tested. This ensures TypeScript will error if the suppressed type issue is fixed, preventing outdated suppressions from lingering. Closes asyncapi#4797
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
📝 WalkthroughWalkthroughReplace TypeScript error suppression directives from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related issues
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🧰 Additional context used🧠 Learnings (16)📓 Common learnings📚 Learning: 2024-11-29T17:36:09.783ZApplied to files:
📚 Learning: 2025-01-19T04:51:41.255ZApplied to files:
📚 Learning: 2024-11-25T18:34:51.303ZApplied to files:
📚 Learning: 2025-01-18T08:44:43.614ZApplied to files:
📚 Learning: 2024-10-18T17:24:45.053ZApplied to files:
📚 Learning: 2025-01-18T08:44:43.614ZApplied to files:
📚 Learning: 2025-01-18T08:44:43.614ZApplied to files:
📚 Learning: 2024-10-18T17:37:50.602ZApplied to files:
📚 Learning: 2024-11-01T13:32:15.472ZApplied to files:
📚 Learning: 2025-04-20T16:05:16.482ZApplied to files:
📚 Learning: 2025-02-16T12:57:24.575ZApplied to files:
📚 Learning: 2024-12-02T05:52:49.547ZApplied to files:
📚 Learning: 2024-11-29T19:42:31.175ZApplied to files:
📚 Learning: 2024-11-10T18:16:35.551ZApplied to files:
📚 Learning: 2024-11-10T18:16:22.273ZApplied to files:
🧬 Code graph analysis (1)tests/build-post-list.test.ts (1)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4826 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 798 798
Branches 146 146
=========================================
Hits 798 798 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-4826--asyncapi-website.netlify.app/ |
|
@coderabbitai review Please verify if this PR is ready to merge. All CI checks have passed (tests on Ubuntu, Windows, macOS) and the code coverage remains at 100%. |
🧩 Analysis chain🏁 Script executed: Length of output: 6315 @singhaditya73: I've verified your PR and it looks excellent! ✅ Verification Results:
Example of improvements: // Before:
// @ts-ignore, ignore the type error for this test
await expect(buildPostList(postDirectories, undefined, writeFilePath))...
// After:
// @ts-expect-error - Intentionally passing undefined basePath to test error handling
await expect(buildPostList(postDirectories, undefined, writeFilePath))...This refactoring follows TypeScript best practices and improves type safety by ensuring TypeScript will fail if the expected errors no longer exist, preventing outdated suppressions. The PR is ready to merge! 🎉 🧠 Learnings used✅ Actions performedReview triggered.
|
|
@derberg @princerajpoot20 @akshatnema @sambhavgupta0705 @anshgoyalevil @Mayaleeeee Please take a look at this PR. Thanks! 👋 |
|
hey @princerajpoot20 @anshgoyalevil could u please review this PR. |
This PR replaces
@ts-ignorewith@ts-expect-errorin test files to improve type safety. It ensures TypeScript fails when an expected error no longer exists, preventing outdated suppressions.🎯 Reason
Tests sometimes intentionally pass invalid data, where TypeScript errors are expected.
Why
@ts-expect-error?📋 Changes
✅ Example
Before
After
🔍 Verification
Screenshot showing no

@ts-ignoreremaining in the tests folder:Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.