Skip to content

Getting autocomplete in VS Code components JS files #1840

Answered by mootari
bbkane asked this question in Q&A
Discussion options

You must be logged in to vote

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:

    "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. @foo/bar becomes @types/…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@mootari
Comment options

mootari Nov 25, 2024
Collaborator

@mootari
Comment options

mootari Nov 25, 2024
Collaborator

@bbkane
Comment options

@mbostock
Comment options

@bbkane
Comment options

Answer selected by bbkane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants