- 
 
- 
  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
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
npm i https://pkg.pr.new/@vue/compiler-core@13998
@vue/compiler-dom
npm i https://pkg.pr.new/@vue/compiler-dom@13998
@vue/compiler-sfc
npm i https://pkg.pr.new/@vue/compiler-sfc@13998
@vue/compiler-ssr
npm i https://pkg.pr.new/@vue/compiler-ssr@13998
@vue/reactivity
npm i https://pkg.pr.new/@vue/reactivity@13998
@vue/runtime-core
npm i https://pkg.pr.new/@vue/runtime-core@13998
@vue/runtime-dom
npm i https://pkg.pr.new/@vue/runtime-dom@13998
@vue/server-renderer
npm i https://pkg.pr.new/@vue/server-renderer@13998
@vue/shared
npm i https://pkg.pr.new/@vue/shared@13998
vue
npm i https://pkg.pr.new/vue@13998
@vue/compat
npm i https://pkg.pr.new/@vue/compat@13998
commit: 5ce53c0 
Uh oh!
There was an error while loading. Please reload this page.
fix #13937 (comment)
Summary by CodeRabbit
New Features
_foo_x_,123).Improvements
Bug Fixes