1 line
1.5 KiB
Plaintext
1 line
1.5 KiB
Plaintext
<!-- SC_OFF --><div class="md"><p>I have node project (type: module in package.json) and I use typescript lang server.</p> <p>want to make this work: <code>import { scaleBand } from "d3-scale";</code> but can't figure out how. require-ing it works fine.</p> <p>autocomplete and lsp-find-definition don't work, with the latter giving this error</p> <pre><code>helm-M-x-execute-command: Wrong type argument: (or eieio-object class), #s(xref-item #("export function scaleBand<Domain extends { toString(): string } = string>(" 16 25 (face highlight)) #s(xref-file-location "/Users/xxx/Library/Caches/typescript/4.2/node_modules/@types/d3-scale/index.d.ts" 2517 16)), obj </code></pre> <p>edit: </p> <p>eldoc works, no the symbol's type is known to lsp. autocomplete is actually OK.</p> <p>however it's not about import vs. require. The destructuring seems to cause the problem. Doing like bellow causes no errors, but still does not navigate to the definition inside the d3-scale module.</p> <pre><code>import d3_scale from "d3-scale"; const { scaleBand } = d3_scale; </code></pre> <p>​</p> </div><!-- SC_ON -->   submitted by   <a href="https://www.reddit.com/user/gdanov"> /u/gdanov </a> <br/> <span><a href="https://www.reddit.com/r/emacs/comments/q87eg8/lspmode_javascript_node_es2020_import_problem/">[link]</a></span>   <span><a href="https://www.reddit.com/r/emacs/comments/q87eg8/lspmode_javascript_node_es2020_import_problem/">[comments]</a></span> |