Typescript: jsconfig Not Picked Up When tsconfig is Present

Created on 16 May 2017  路  7Comments  路  Source: microsoft/TypeScript



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

Awaiting More Feedback Suggestion VS Code Tracked

Most helpful comment

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.

All 7 comments

That is actually by design. tsconfig.json is always given preference, and if it is not applicable it is skipped. i would like to get more user input on this before making a decision whether to change the current design or not.

Thanks @mhegazy.

Can you take a look at https://github.com/Microsoft/vscode/issues/26550#issuecomment-301670427 and see if there are other ways to address the issue @TripleSnail was running into

@mhegazy I use different compilers for JS and TS so it's pretty frustrating that I can't specify the compiler options separately.

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.

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?

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

Same here. I use tsconfig because it's a TypeScript project. But also have Node scripts in JavaScript and want the "checkJs" feature. In subfolder "tools", it works. But I also have some js-files in root. I think both files can work since one config file is for ts-files and the other one for js-files. ... I don't want tsconfig allowJs. It's a different setup. 馃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nitzantomer picture nitzantomer  路  135Comments

tenry92 picture tenry92  路  146Comments

Gaelan picture Gaelan  路  231Comments

jonathandturner picture jonathandturner  路  147Comments

rbuckton picture rbuckton  路  139Comments