-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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: type definitions for HtmxExtension #2721
fix: type definitions for HtmxExtension #2721
Conversation
36be96a
to
1132079
Compare
The two errors in the test are related to I took a look at the implementations at
What would the expected behavior be? I'd offer to update |
@MichaelWest22 thanks for noticing! I found it when checking the failing tests and just force-pushed a fix, adding it to the Edit: forgot to update |
1132079
to
e765568
Compare
Also the see web link is now linking to 404 after htmx 2 upgrade and the split from to a new extension. maybe this see link needs to link to https://github.com/bigskysoftware/htmx-extensions/blob/main/README.md instead maybe since I can't see any other place this info is now. the info here also probably needs updating... |
e765568
to
1c947d9
Compare
There is https://htmx.org/docs/#extensions, but itself just points to the README you linked. I've updated the link accordingly and going to file a PR against https://github.com/bigskysoftware/htmx-extensions to update the type information in the README as well. |
62e0162
to
b33acce
Compare
@Telroshan I updated the return type of |
Perfect thanks! Last request; could you remove the changes to |
b33acce
to
cfcdeac
Compare
cfcdeac
to
815a466
Compare
Oh, sorry ... but sure - I removed the changes from the |
Thanks! |
@cngJo Hi, just curious, was it intentional that each field on HtmxExtension is required with the new type? I believe on HTMX v1, just the onEvent was sufficient for creating a new extension. With this change, TS forces you to add each field to the extension obj, even if you aren't needing to override it |
Hey, nope that's an oversight @maddalax indeed Though the issue isn't that PR in itself (that introduced back the types for HtmxExtension that was a Maybe we should declare a separate JSDoc for the If you'd like to investigate into it and submit a fix PR @maddalax, please do! PR welcome See Lines 4805 to 4834 in e6a2ea1
|
Ah gotcha sorry I skipped over the part that it was auto generated. I may have some time to investigate this today, will see if I can come up with anything. Thanks for letting me know :) |
The @see tag prevented
tsc
to properly generate types forHtmxExtension
. Moving the@see
above@typedef
fixes this and adds types forHtmxExtension
back to the package ;-)Description
#2336 updated type generation but as a side effect the type definition of
HtmxExtension
got dropped / changed toany
.This is fixed now ;)
Note: I did not create an issue to prevent spam, if it's important, I'm more than happy to create one after the fact 😉
Testing
Please explain how you tested this change manually, and, if applicable, what new tests you added. If
you're making a change to just the website, you can omit this section.
Checklist
master
for website changes,dev
forsource changes)
approved via an issue
npm run test
) and verified that it succeeded