-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Ignore unsupported once
option
#29
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this PR also change the accepted options types? E.g.
options?: boolean | Omit<AddEventListenerOptions, 'once'>
(But then TypeScript does complain about the runtime check.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
index.ts
Outdated
@@ -93,7 +94,7 @@ function delegate< | |||
selector: Selector, | |||
type: TEventType, | |||
callback: delegate.EventHandler<GlobalEventHandlersEventMap[TEventType], TElement>, | |||
options?: boolean | AddEventListenerOptions | |||
options?: boolean | Except<AddEventListenerOptions, 'once'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can skip the extra dependency here, especially because this is not a devDependency. This type appears in the generated index.d.ts
file and will fail when imported by third parties.
options?: boolean | Except<AddEventListenerOptions, 'once'> | |
options?: boolean | Omit<AddEventListenerOptions, 'once'> |
Omit
is only bad because you can use it as Omit<OtherType, 'mistyped-ooonce'>
and it doesn't fail. This isn't really a problem here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing…
Dammit 🥲 I’ll fix it |
3.0.1 published |
Follow-up of #28 (comment)