Repository navigation
fix(ClosePopup&Ripple): allow undefined in the directive value type - #18605
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Thank you for catching this and contributing with a fix! |
On behalf of Mathieu G. (mr-zwets), written by Claude Opus 5.5:
What changes and why
v-close-popupandv-ripplewithout a value are the documented default forms, and both directives handle it at runtime: for a value-less directive Vue passesbinding.value === undefined, whichClosePopup.jstreats as depth 1 (getDepth) andRipple.jsas enabled (value !== false). TheClosePopup.jsondescription also says "if value is 1 or 'true' or undefined then it closes only the parent popup".The API JSON leaves
undefinedout of the value type, so the generated types arewhile Vue's
DirectiveBinding<Value>hasvalue: Value, so the types reject the form the runtime and the docs use. Type checkers that check a value-less directive's binding report every use: Vue Language Tools types that value asundefinedsince vuejs/language-tools#6335 (merged, not yet released), and its v4 type checker reports the error once per use:This adds
"undefined"tovalue.typeinClosePopup.jsonandRipple.json, as the Scroll, ScrollFire and Touch* directives already have.Breaking change?
No. The value types only widen.
How was it validated?
as undefinedvalue test toClosePopup.test.js, matching the one inScroll.test.js(Ripple already has ano valuetest). The ClosePopup and Ripple test files pass, and so doespnpm test:specs:check.pnpm build js types):ClosePopupValueandRippleValuenow end in| undefined. This file failed with TS2322 on both lines against the old types and compiles against the new ones:Docs
None needed: the docs pages render the directives' API from the same JSON, and the ClosePopup description already mentions
undefined.Summary by CodeRabbit
close-popupandrippledirective documentation to includeundefinedas an accepted value type. This clarifies that these directives may be used without an explicit value.