test: strict type assertion - #15107
Conversation
📝 WalkthroughWalkthroughThe pull request upgrades the declaration-test ChangesDeclaration test assertion migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages-private/dts-test/component.test-d.ts`:
- Around line 201-204: Replace the boxed Number-based expectAssignable
assertions in the rawBindings checks and the corresponding assertion groups at
the referenced locations with exact expectType assertions using lowercase number
and Ref<number> types. Preserve the optional union for setupD as Ref<number> |
undefined, and update all three affected groups consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0d7df7f7-bf52-446b-a355-6e78eb5cc066
📒 Files selected for processing (20)
packages-private/dts-test/appDirective.test-d.tspackages-private/dts-test/built.test-d.tspackages-private/dts-test/compiler.test-d.tspackages-private/dts-test/component.test-d.tspackages-private/dts-test/componentInstance.test-d.tsxpackages-private/dts-test/componentTypeExtensions.test-d.tsxpackages-private/dts-test/defineComponent.test-d.tsxpackages-private/dts-test/defineCustomElement.test-d.tspackages-private/dts-test/directives.test-d.tspackages-private/dts-test/extractProps.test-d.tspackages-private/dts-test/functionalComponent.test-d.tsxpackages-private/dts-test/h.test-d.tspackages-private/dts-test/inject.test-d.tspackages-private/dts-test/reactivity.test-d.tspackages-private/dts-test/ref.test-d.tspackages-private/dts-test/scheduler.test-d.tspackages-private/dts-test/setupHelpers.test-d.tspackages-private/dts-test/tsx.test-d.tsxpackages-private/dts-test/utils.d.tspackages-private/dts-test/watch.test-d.ts
@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: |
Size ReportBundles
Usages
|
edison1105
left a comment
There was a problem hiding this comment.
The exact-equality helper is a good direction, but this migration currently treats several suspicious existing types as the new contract and removes positive coverage. I verified the full DTS suite at both the PR base and head, then added focused usage checks: mutable models inferred from primitive defaults reject other values, raw-object ComponentInstance results are unsound, and the expectAssignable versions of the generic-ref and local-directive cases pass. Please address the inline issues, restore the removed positive coverage, and add a small sanity test for the helper (1 vs number, any vs number, and readonly vs mutable). It would also be better to retain the documented method-signature defineSlots case unless changing that test scenario is intentional.
cb23eb9 to
a8a0b0f
Compare
Summary
expectTyperequire exact type equalityexpectAssignablewhere assignability is intentionalThis pull request was created with assistance from a code agent.
Summary by CodeRabbit
expectTypehelper to enforce type equality, with additional dts test coverage for failure cases.