-
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
TypeScript .d.ts type definitions improvement #5767
Conversation
# Conflicts: # handsontable.d.ts
You're really helpful. That's a great job! |
@aaronbeall I'm deeply impressed by the amount of work you put into this. Could you please shoot me an email at chris(at)handsontable.com? I would like to discuss one thing before we merge these changes. Thanks so much! |
@aaronbeall That's really impressive! I have one small suggestion, though:
Internally we tend to use the term "events" as native DOM events, and "hooks" as our internal events. That being said, splitting the hook API and hooks themselves, just like you did, is definitely a good idea. I think it would be good to move the Other than that everything looks great! |
@wojciechczerniak awesome! |
Yep, sounds good. Done! TBH I wanted to keep the event hooks interface as Edit: Hmm... how about putting |
Good idea, |
Done |
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.
👍
Aaron, thanks to you we got a brand you definition file for the Handsontable 7.0.0 released today. Thank you :) |
Context
Addresses: #5736
Also fixes: #5225 #5004 #5091 #5046
Includes fixes for #5719 #5721
Relates to: #5094
This is a sweeping refinement of the type definitions. Main goals were:
GridSettings
,Hooks
andCore
methods (ie not plugins except where referenced by settings) to make the Handsontable config completely typed.any
andobject
andstring
(where literals are expected) with meaningful types. Basically I added a bunch of types to represent the various config objects and hook arguments.Additional refactoring:
CellValue
,CellChange
,RowObject
. Intentionally left these very wide (exCellValue = any
) to avoid breaking things, but it improves readability and any future refactoring of these base types. We could potentially use type arguments to make these even tighter based on users' usage.GridSettings
up intoGridSettings -> ColumnSettings -> CellMeta -> CellProperties
in order to sort out some of the issues related to https://github.com/handsontable/docs/issues/12.GridSettings
still has almost everything. I commented these types in the code for the rationale on this breakdown.DefaultSettings
is a class-like object that createsGridSettings
, so I updated type annotations to reflect this and replaced all annotations ofDefaultSettings
to the correct type settings type (grid, column, cell).Hooks
out intoEvents
andHooks
, whereEvents
is just theHooks -> Events
in the docs, andHooks
the methods available on theHandsontable.hooks
namespace.Element
andEvent
where possible.this
types where useful, for example in validators and cells callback.Handsontable.validators
API.How has this been tested?
npm run test:types
, strengthened coverage usingRequired<>
map type. Still adding some more to cover nested config objects.Types of changes
Related issue(s):
Checklist: