diff --git a/src/CollapsableItem.ts b/src/CollapsableItem.ts index 6a08324..0073a43 100644 --- a/src/CollapsableItem.ts +++ b/src/CollapsableItem.ts @@ -41,7 +41,7 @@ export class CollapsableItem { const controlElements = element.querySelectorAll(collapsable.options.control) const boxElements = element.querySelectorAll(collapsable.options.box) - if (!controlElements.length || !boxElements.length) { + if (!boxElements.length) { throw new Error(`Collapsable: Missing control or box element.'`) } @@ -295,4 +295,12 @@ declare global { 'collapsed.collapsable': CollapsableEvent 'destroy.collapsable': CustomEvent } + + interface DocumentEventMap { + 'expand.collapsable': CollapsableEvent + 'expanded.collapsable': CollapsableEvent + 'collapse.collapsable': CollapsableEvent + 'collapsed.collapsable': CollapsableEvent + 'destroy.collapsable': CustomEvent + } }