-
-
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
typing for defineExtension
should allow partials
#3028
Conversation
bfd8df0
to
fa220a6
Compare
The /**
* defineExtension initializes the extension and adds it to the htmx registry
*
* @see https://htmx.org/api/#defineExtension
*
* @param {string} name the extension name
* @param {HtmxExtension} extension the extension definition
*/
function defineExtension(name, extension) { So this is where i think it would need updating. I would suggest making the change here on your local machine and then do a |
Ah thanks, I have amended that PR to update the correct file |
Sorry if you use npm run dist to test the distributed output you need to exclude the dist folder changes from the PR as normally only src/htmx.js is changed in dev PR's to make it easier to review changes. Dist only updates during release process normally |
Sorry yes, I realised that and have force pushed again to remove the latter commit However that push appears to be stuck in GitHub 'processing' somehow: I've never seen that before 🤷♂️ Actual diff against my branch shows it gone: dev...anentropic:htmx:patch-1 |
I guess it will eventually resolve itself |
GitHub seems to have given up/failed I'll close this and open a new PR |
Description
Docs for custom extensions show:
https://htmx.org/extensions/building/
However the current typing doesn't allow this - it requires a fully populated
HtmxExtension
object defining all the methods:Testing
I made a working extension in my project and ignored the typing errors. (This is what prompted making this PR)
Changing the type to
Partial<HtmxExtension>
in my installed copy ofhtmx.esm.d.ts
makes the typing errors go away and seems to reflect intended usage.Checklist
master
for website changes,dev
forsource changes)
approved via an issue
npm run test
) and verified that it succeeded