-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
types(defineProps): avoid never props becoming boolean flags #14059
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?
Conversation
WalkthroughRefines a conditional type used to detect boolean-like prop keys and adds a type test ensuring props declared as Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as defineProps call site
participant BooleanKey as BooleanKey<T>
participant TS as TypeScript resolver
Note over Dev,TS: Type selection for each prop key
Dev->>BooleanKey: provide prop type T[K]
BooleanKey->>TS: evaluate "T[K] extends boolean | undefined?"
TS-->>BooleanKey: yes/no
alt matches boolean|undefined
BooleanKey->>TS: evaluate "T[K] extends never | undefined?"
TS-->>BooleanKey: yes -> exclude key
TS-->>BooleanKey: no -> include key
else does not match
BooleanKey-->>Dev: exclude key
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (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)
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: |
close #14056
Summary by CodeRabbit
Tests
never, ensuring regressions are caught.Bug Fixes
defineProps, providing stricter and more accurate editor hints and fewer incorrect type widenings.