-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
fix(compiler-sfc): resolve numeric literals and template literals without expressions as static property key #13998
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: main
Are you sure you want to change the base?
fix(compiler-sfc): resolve numeric literals and template literals without expressions as static property key #13998
Conversation
WalkthroughUpdated type-key extraction and mapping in compiler-sfc: added a string-literal key helper, switched resolveType to use it for static and computed keys, removed separate TemplateLiteral handling, and added tests covering template-literal and numeric literal prop keys and mapped template-literal types. Changes
Sequence Diagram(s)sequenceDiagram
participant Test as Test (spec)
participant Resolver as resolveType.typeElementsToMap / findStaticPropertyType
participant Utils as utils.getStringLiteralKey
Note over Test,Resolver: New key extraction flow for prop/type keys
Test->>Resolver: provide type element (Identifier | StringLiteral | NumericLiteral | TemplateLiteral | computed)
Resolver->>Utils: getStringLiteralKey(node)
alt returns non-null string key
Utils-->>Resolver: "key" (e.g., "qux", "123", "_foo_x_")
Resolver-->>Test: create map entry with extracted key and inferred runtime type
else returns null
Utils-->>Resolver: null
Resolver-->>Test: skip/handle as unsupported computed key
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ 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 (3)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🧬 Code graph analysis (1)packages/compiler-sfc/src/script/resolveType.ts (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). (4)
🔇 Additional comments (3)
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: |
fix #13937 (comment)
Summary by CodeRabbit
New Features
_foo_x_
,123
).Improvements
Bug Fixes