-
Hello! How do I enable VS Code Intellisense inside JS files? What I'm doing:
I've tried this on macOS and PopOS. Maybe the issue is how the default import works? import * as Plot from "npm:@observablehq/plot"; Or maybe I need to install some types definition? I searched the repo for "vscode", "autocomplete", "intellisense", but I didn't see anyone else asking about this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
The pragmatic answer is to install and import Plot locally because it bundles its own types. Afaik TypeScript does not support remote type declarations, which means that whatever types you want to reference have to be available locally. If you were to import from a package like "paths": {
"npm:d3": ["./node_modules/@types/d3"]
}, Note that even though the path is allowed to contain a single wildcard, it won't do us any good in most cases because of the way DT packages are named (e.g. "npm:*": ["./node_modules/@types/*"] (but again, don't!) |
Beta Was this translation helpful? Give feedback.
The pragmatic answer is to install and import Plot locally because it bundles its own types.
Afaik TypeScript does not support remote type declarations, which means that whatever types you want to reference have to be available locally. If you were to import from a package like
d3
which has its types provided via DefinitelyTyped, you could install the respective type declarations (@types/d3
) and then add the following to your tsconfig.json:Note that even though the path is allowed to contain a single wildcard, it won't do us any good in most cases because of the way DT packages are named (e.g.
@foo/bar
becomes@types/…