fix(types): preserve slot prop requiredness in SlotsType - #15109
fix(types): preserve slot prop requiredness in SlotsType#15109KazariAI wants to merge 2 commits into
SlotsType#15109Conversation
📝 WalkthroughWalkthroughFunction-valued slot types now use required property handling during unwrapping. Type tests update optional slot prop assertions and enforce non-undefined scopes where required. ChangesSlot typing
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
@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.
I found one blocking type regression.
| [K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any | ||
| ? T[K] | ||
| : Slot<T[K]> | ||
| : Slot<Required<T>[K]> |
There was a problem hiding this comment.
Required<T>[K] also removes an explicitly declared undefined from an optional property when exactOptionalPropertyTypes is disabled, as it is in packages-private/dts-test/tsconfig.test.json. For optionalUndefinedScope?: undefined | { data: string }, this makes both slots.optionalUndefinedScope?.() and slots.optionalUndefinedScope?.(undefined) fail. The PR removes the existing test that covered exactly this combination, which contradicts the stated goal of preserving empty and undefined calls when slot props explicitly include undefined. Please restore that coverage and preserve this behavior, or explicitly narrow and document the supported contract; enabling exactOptionalPropertyTypes only in the test config would not protect consumers using the default setting.
a1ed2d7 to
50e3fb0
Compare
|
Thanks for catching this. Closing because with |
Summary
undefinedin optional propertiesundefinedThis pull request was created with assistance from a code agent.
Summary by CodeRabbit