HTMX 2.0 jsdoc typehints not working in typescript files. #2453
-
I'm using neovim with the tsserver lsp, and I get type hints and autocompletion with other libraries. I think either I'm doing something wrong or htmx is misconfigured. Or should this even work? I'm using htmx v2.0.0-beta2 This is my import: import { htmx } from 'htmx.org/dist/htmx.esm.js' this is the lsp diagnostic error I get:
If I add the module declaration in my d.ts file, the error goes away but my htmx variable is still Here is my tsconfig JIC: {
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I just found that if I copy the file out of import { htmx } from './htmx.esm.js' |
Beta Was this translation helpful? Give feedback.
-
So I added This is not really an HTMX issue, So I'm going to close it. |
Beta Was this translation helpful? Give feedback.
So I added
"maxNodeModuleJsDepth": 1,
to my tsconfig compiler options and now it works importing from node_modules.This is not really an HTMX issue, So I'm going to close it.