feat(runtime-vapor): implement defineVaporCustomElement type inference#14183
feat(runtime-vapor): implement defineVaporCustomElement type inference#14183edison1105 merged 4 commits intominorfrom
defineVaporCustomElement type inference#14183Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/compiler-vapor
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/runtime-vapor
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
There was a problem hiding this comment.
Pull request overview
This PR implements type inference for defineVaporCustomElement, bringing it on par with the regular Vue custom element API. The key improvement is that users no longer need to use as any type assertions when working with custom element instances, as the props are now properly typed based on the component definition.
- Adds comprehensive TypeScript overloads for
defineVaporCustomElementto infer prop types from component definitions - Renames
apiDefineVaporCustomElement.tstoapiDefineCustomElement.tsfor consistency with naming conventions - Removes unnecessary
as anytype assertions throughout the test suite, now that proper type inference is available
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/runtime-vapor/src/index.ts | Updates import path from apiDefineVaporCustomElement to apiDefineCustomElement and exports new type VaporElementConstructor |
| packages/runtime-vapor/src/dom/prop.ts | Updates import path for VaporElement type |
| packages/runtime-vapor/src/component.ts | Updates import path for VaporElement type |
| packages/runtime-vapor/src/apiDefineCustomElement.ts | Adds three type overloads for defineVaporCustomElement to support type inference for setup functions, options objects, and defineVaporComponent return values |
| packages/runtime-vapor/tests/customElement.spec.ts | Removes as any type assertions throughout tests, validating that type inference now works correctly; wraps async component definitions with defineVaporComponent for better type safety |
| packages-private/dts-test/vapor/defineVaporCustomElement.test-d.ts | Adds comprehensive type tests covering all three overload scenarios to validate proper type inference |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.