-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
'htmx.d.ts' is not a module
#2733
Comments
This is my complete {
"compilerOptions": {
"noImplicitAny": false,
"removeComments": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noImplicitThis": true,
"allowJs": true,
"types": [
"htmx.org/dist/htmx"
]
},
"include": ["src/**/*"]
} And that's how I imported HTMX to avoid conflict with the import htmxLib from "htmx.org/dist/htmx.esm.js";
declare global {
interface Window {
htmx: typeof htmx
}
}
// this needs to come first just in case there's a dependency
// with other components
window.htmx = htmxLib; |
This comment was marked as resolved.
This comment was marked as resolved.
@Alexerson I edited my comment. It was actually not correct as the I also added the relevant typescript snippet. I hope it helps. |
Ah, thanks. But in that case, isn’t |
No it's not, because of the window declaration. Whether your fix is a better approach I can't judge tbh. |
Co-authored-by: Alexandre Spaeth <[email protected]>
* Generate .d.ts file from the esm module (#2733) * Fix types annotation filename in package.json (#2734) --------- Co-authored-by: Alexandre Spaeth <[email protected]>
Fixed by: #2769 |
With htmx 2.0.1, I get the following error when trying to
import htmx from "htmx.org";
:File './node_modules/htmx.org/dist/htmx.d.ts' is not a module.ts(2306)
I believe this is happening because the
htmx.d.ts
file should includeexport default htmx;
.Adding this line manually in the file fixes the issue.
I will create a PR for this.
The text was updated successfully, but these errors were encountered: