-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
fix(compiler): using guard instead of non-nullish assertion #13982
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(compiler): using guard instead of non-nullish assertion #13982
Conversation
WalkthroughRequires a non-empty directive argument when applying same-name v-bind shorthand in transformVBindShorthand; accesses Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Template Author
participant Parser as Parser
participant Transform as transformVBindShorthand
participant Reporter as ErrorReporter
Dev->>Parser: Provide v-bind shorthand (e.g., :foo or :)
Parser->>Transform: Directive node with `arg` and `exp`
Transform->>Transform: Check: `!prop.exp && prop.arg`
alt arg present and exp missing
Transform->>Transform: Use `arg` as same-name shorthand
else arg missing or invalid
Transform->>Reporter: Report X_V_BIND_INVALID_SAME_NAME_ARGUMENT
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (1)
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 |
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/compiler-core/src/transforms/transformVBindShorthand.ts(1 hunks)
🧰 Additional context used
🪛 GitHub Check: test / lint-and-test-dts
packages/compiler-core/src/transforms/transformVBindShorthand.ts
[failure] 24-24:
Property 'content' does not exist on type 'never'.
[failure] 23-23:
Property 'type' does not exist on type 'never'.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test / e2e-test
Description
core/packages/compiler-core/src/transforms/transformVBindShorthand.ts
Line 20 in 079010a
This non-nullish assertion is harmful that it will be broken on language service when user has only typed
:on an element, in that case we shouldn't treat the single:as aVBindShorthandWe got error thrown below
How to reproduce
https://play.vuejs.org/#eNp9UbFOwzAQ/ZXDS5cmGWCKIiRAHWAoCDp6CcnRpCS2ZV/SoCoDCz/Awsa/8QV8AudEbTqgDrZ8997zvWfvxJUxYdugiEXiMlsaAofUmEupogiWmopSrcMwhN/vr3epkmgkMcwFYW2qlJArgOQsCODn4xNWbwYhBcfCCmEWz+AZK72F1EFKZCEIJj6sClSgDW+ZVk6zwCECFX5ZvcUc0Fo9ifKyhRgiLpLoaLyYC3J8w0u5DjdOK46z83wpMl2bskJ7b6jkCVLEMCAeSyv2dTf0yDY43/ezArPXf/ob1/meFA8WHdoWpThglNo10ggvnpbY8fkA1jpvKmafAB+R0zfe40i7blTOto94g9vb2mhL/LQrt+gIlduH8kY9sx/4UvCf3pyIPtk9Dy8GnVS96P8Ayt+tIA==
Summary by CodeRabbit
Bug Fixes
Developer Experience