-
Notifications
You must be signed in to change notification settings - Fork 418
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
fix(keyboard): bind-method typing still requires EventTarget #948
Conversation
I would prefer removing the parameter from the generated typing entirely if it is possible. I don't know whether the type-generation tooling has a handling for this use case, as |
CC @jarekdanielak I believe a follow-up is needed (this PR, to be checked) to properly move fix our type definitions, too. |
Thanks @torge-hmn for the PR ⭐ . We'll have a look. |
@@ -125,7 +125,7 @@ Keyboard.prototype._isEventIgnored = function(event) { | |||
/** | |||
* Bind keyboard events to the given DOM node. | |||
* | |||
* @param {EventTarget} node | |||
* @param {undefined} node | |||
*/ | |||
Keyboard.prototype.bind = function(node) { |
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.
We should rather fix the method signature, not require any argument, and check whether an argument is provided via arguments[0]
. This change looks odd.
Keyboard.prototype.bind = function(node) { | |
Keyboard.prototype.bind = function() { |
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.
Fixed via 36316be.
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.
Much better solution, thank you! 👍 (I wasn't sure if I could change the signature tbh)
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.
We want to ensure that any signature change is tested; in this case I marked the old behavior as deprecated; it will throw at run-time. In the future we want to remove it all together.
6798456
to
36316be
Compare
36316be
to
3a8434a
Compare
@jarekdanielak Ready for your review! |
Co-authored-by: Jarek Danielak <[email protected]>
Thanks @torge-hmn for the report + initial fix. |
Thanks for fixing! 👍 |
Published via [email protected]. |
Proposed Changes
In a previous update the ability to bind the keyboard to a specific node has been removed. The current JS-doc resulted in a generated type definition still requiring an
EventTarget
as parameter for thebind
method even though supplying this parameter leads to an error and has no effect.Prior (generated
Keyboard.d.ts
):After:
Checklist
To ensure you provided everything we need to look at your PR:
@bpmn-io/sr
tool: Just use type generationRelated to #662