-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix: support ts-module #23
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis update enhances TypeScript compatibility in module imports by adjusting the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #23 +/- ##
==========================================
+ Coverage 87.65% 88.00% +0.34%
==========================================
Files 6 6
Lines 413 425 +12
Branches 53 53
==========================================
+ Hits 362 374 +12
Misses 51 51 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
src/import.ts (1)
Line range hint
58-83
: The modified conditional logic inimportModule
enhances TypeScript module compatibility. However, there's an unsafe usage of optional chaining.- if (obj?.default?.__esModule === true && 'default' in obj?.default) { + if (obj?.default && obj.default.__esModule === true && 'default' in obj.default) {This change ensures that the evaluation does not throw a TypeError if
obj.default
is undefined.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- src/import.ts (2 hunks)
- test/fixtures/ts-module/exports.ts (1 hunks)
- test/fixtures/ts-module/index.ts (1 hunks)
- test/fixtures/ts-module/mod.ts (1 hunks)
- test/import.test.ts (1 hunks)
Files skipped from review due to trivial changes (3)
- test/fixtures/ts-module/exports.ts
- test/fixtures/ts-module/index.ts
- test/fixtures/ts-module/mod.ts
Additional context used
Biome
src/import.ts
[error] 59-59: Unsafe usage of optional chaining. (lint/correctness/noUnsafeOptionalChaining)
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
Additional comments not posted (1)
test/import.test.ts (1)
87-119
: The new test cases for TypeScript modules are well-implemented and thorough, covering various import scenarios effectively.
[skip ci] ## [4.0.2](v4.0.1...v4.0.2) (2024-06-17) ### Bug Fixes * support ts-module ([#23](#23)) ([c032932](c032932))
Summary by CodeRabbit
New Features
Tests