question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jsconfig Not Picked Up When tsconfig is Present

See original GitHub issue

From: https://github.com/Microsoft/vscode/issues/26550

TypeScript Version: 2.3.3

Repo Create a folder that contains both a tsconfig.json for ts files and a jsconfig.json for js files

Expected behavior: Both projects are picked up

Actual behavior: Only the TSConfig is picked up

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:20
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

18reactions
gersongoulartcommented, Nov 15, 2019

I have a large project written in Javascript that we want to migrate to TypeScript. The process will be slow and take a long time but meantime all import aliases are broken on javascript for this reason. It’d be nice if VSCode would implement aliases on both file types or at least fallback to jsconfig.json on .js files.

10reactions
mohammadalipakcommented, Apr 28, 2020

I have a mixed JS/TS codebase, and I need to specify a paths object in order to get my Webpack aliases to work with VS Code, but I don’t want to display TS errors in JS files. Is there way to achieve this?

My first thought was to have a both a jsconfig.json and a tsconfig.json, but apparently having the former present is the same as specifying allowJs: true in the latter?

Ya VSCode will ignore jsconfig.json when tsconfig.json is present. The way to make paths resolution (or aliases) work is to simply set allowJs: true in tsconfig.json and delete jsconfig.json as it won’t be used.

See: https://github.com/Microsoft/vscode/issues/41890#issuecomment-364897596

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does VSCode not pick up path aliases in tsconfig?
The tsconfig configuration will only apply to files matched by the "include" option and not excluded by the "exclude" option.
Read more >
jsconfig.json Reference - Visual Studio Code
If no include attribute is present, then this defaults to including all files in the containing directory and subdirectories. When a include attribute...
Read more >
Documentation - What is a tsconfig.json - TypeScript
The tsconfig.json file specifies the root files and the compiler options required to compile the project. JavaScript projects can use a jsconfig.json file ......
Read more >
Javascript - vscode-docs
File Scope - no jsconfig.json: In this mode, JavaScript files opened in Visual Studio Code are treated as independent units. As long as...
Read more >
tsconfig-paths - npm
Load node modules according to tsconfig paths, in run-time or via API. ... @returns the found path, or undefined if no path was...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found