Closed anentropic closed 4 days ago
The dist/htmx.esm.d.ts
is a compiled distribution output file and not an editable source file. This thing is built from the JSDoc comments in the src/htmx.js file like
/**
* 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 npm run dist
to regenerate the esm.d.ts file and retest with this file to confirm it works as expected
The
dist/htmx.esm.d.ts
is a compiled distribution output file and not an editable source file. This thing is built from the JSDoc comments in the src/htmx.js file
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 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: https://github.com/bigskysoftware/htmx/compare/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
for source changes)npm run test
) and verified that it succeeded