-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Annotate Events functions types with this: Core as they are always bound #10812
base: develop
Are you sure you want to change the base?
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.
This is a really annoying one I think we might want to completely avoid, not all plugin hooks are called with Core
as context and it is going to be a real pain to determine the context so I am fine if we need to break some typescript rules when writing our tests.
I would close the pr and make the necessary modifications on other pr if needed.
OK got it @evanSe. I'm fine closing it. We can always override at the caller side with:
Although note that this happens not only in the test code, but it will happen in any TS-enabled client codebase that provides the hooks via settings. |
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.
Actually, it is all correct 😄
I will merge shortly |
Context
The TypeScript types exposed by Handsontable does not specify the type of
this
pointer for the Events methods, while they are always called byrunHooks
method ofCore
and they are always bound toCore
instance. Lack of this type annotation leads to implicitany
typing that is forbidden in TypeScript strict mode.Current state:
State after the proposed change:
How has this been tested?
N/A - just a typing change
Types of changes
Related issue(s):
Affected project(s):
handsontable
@handsontable/angular
@handsontable/react
@handsontable/vue
@handsontable/vue3
Checklist: