fix(volar): use ts.idText() instead of .text in sfc-typed-router#2607
fix(volar): use ts.idText() instead of .text in sfc-typed-router#2607posva merged 1 commit intovuejs:mainfrom
Conversation
✅ Deploy Preview for vue-router canceled.
|
📝 WalkthroughWalkthroughA minor refactoring in the router's Volar entry point replaces direct property access with the TypeScript API's Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 🧪 Unit Test Generation v2 is now available!We have significantly improved our unit test generation capabilities. To enable: Add this to your reviews:
finishing_touches:
unit_tests:
enabled: trueTry it out by using the Have feedback? Share your thoughts on our Discord thread! 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 |
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2607 +/- ##
=======================================
Coverage 85.26% 85.26%
=======================================
Files 84 84
Lines 9774 9774
Branches 2218 2218
=======================================
Hits 8334 8334
Misses 1428 1428
Partials 12 12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
posva
left a comment
There was a problem hiding this comment.
Nice, thanks a lot! This fixes vue-tsc usage
The sfc-typed-router Volar plugin fails to transform
useRoute()calls when used withvue-tscbecause it usesnode.expression.textto check for the identifier name.The
.textgetter only exists onIdentifierObject(TypeScript Language Service nodes), but Volar usests.createSourceFile()which produces raw Compiler API nodes that only have.escapedText.Use
ts.idText(node.expression)which works with both node types.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.