DEV Community

Bruce Axtens
Bruce Axtens

Posted on

How do I set up VSCode to edit typescript targeting ES3 and using custom @types?

0

Context: NOT node. Rather, I'm targeting a C# wrapper around JScript (ES3 mostly.) So I don't want to use explicit export/import technologies. I just want my d.ts files to be parsed and used in VSCode to resolve symbols.

I'm trying to separate my custom types from my source folder but…

Top comments (1)

Collapse
 
bugmagnet profile image
Bruce Axtens • Edited

My work around is as follows:

  • In my source folder I have a subfolder called "types". Into this I put JUNCTION links to folders that contain the @types folders that I want to reference.
  • In my tsconfig.json I have
  "include": [
    "*.ts",
    "./types"
  ]
Enter fullscreen mode Exit fullscreen mode

which causes VSCode to parse the declare statements therein.

I expect that I will still have to include a typeRoots so that compilation works. Currently the compilation process (which involves running tsc and then renaming the resulting .js files to .rr or .ri) complains about the symbols that VSCode can see but tsc can't.