You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Possible problem with multiple tsconfig.json files in subdirectories #10084
The problem is that the code inside the mySubProject folder doesn't see the code in the typings folder. The compiler only looks from the tsconfig.json file downwards. If you want to keep your layout you can do the following: add a file typings.d.ts with the following content to the MySubProject folder
I have solved the problem by removing/renaming the second tsconfig.json in MySubProject.
My main point was that the VSCode is not consistent and it looks like a bug:
Once I compile the project and VSCode UI shows zero errors,
After that I touch any key eg. space suddenly the errors appears.
What's more, logically when I compile the top project with tsc it's not showing any error and so the VSCode shouldn't as well.
I guess the problem is in the VSCode that it's using both of the tsconfig.json contrary to the tsc -p . that use only one found in the path passed as a parameter. I believe VSCode should do exactly the same.
The more I think about the problem, I am inclined to the opinion that it is a BUG in VSCode.
The compiler only looks from the tsconfig.json file downwards.
Dirk Bäumer (@dbaeumer) I read again your answer and I'm not sure you saw that in this test project are TWOtsconfig.json files.
I totaly agree and understand that compiler is looking only downwards but I think it should start with the same path as tsc compiler.
I do understand that the project has two tsconfig.json files and the problem is a misalignment between the tsc and the tsserver in terms of the project team. I will move the issue to the TS to comment on. For the TS team:
when running tsc -p . it compiles the files in MySubProject using the tsconfig.json from root.
when open a file in the tsserver from MySubProject the tsconfig.json from the MySubProject folde is used.
Activity
dbaeumer commentedon Aug 4, 2016
I was able to reproduce this.
dbaeumer commentedon Aug 4, 2016
The problem is that the code inside the mySubProject folder doesn't see the code in the typings folder. The compiler only looks from the tsconfig.json file downwards. If you want to keep your layout you can do the following: add a file typings.d.ts with the following content to the MySubProject folder
This makes it work correctly.
a8775 commentedon Aug 4, 2016
Thank you Dirk Bäumer (@dbaeumer) for that hint.
I have solved the problem by removing/renaming the second
tsconfig.jsonin MySubProject.My main point was that the VSCode is not consistent and it looks like a bug:
What's more, logically when I compile the top project with
tscit's not showing any error and so theVSCodeshouldn't as well.I guess the problem is in the
VSCodethat it's using both of thetsconfig.jsoncontrary to thetsc -p .that use only one found in the path passed as a parameter. I believeVSCodeshould do exactly the same.The more I think about the problem, I am inclined to the opinion that it is a BUG in
VSCode.Dirk Bäumer (@dbaeumer) I read again your answer and I'm not sure you saw that in this test project are TWO
tsconfig.jsonfiles.I totaly agree and understand that compiler is looking only downwards but I think it should start with the same path as
tsccompiler.dbaeumer commentedon Aug 11, 2016
I do understand that the project has two tsconfig.json files and the problem is a misalignment between the tsc and the tsserver in terms of the project team. I will move the issue to the TS to comment on. For the TS team:
This results in different project scopes.
dbaeumer commentedon Aug 11, 2016
This issue was moved to microsoft/TypeScript#10283
a8775 commentedon Aug 11, 2016
Dirk Bäumer (@dbaeumer) sorry I was raising the problem again, I would like the tool I use every day was perfect for everyone :)
I appreciate the work of all team, thanks a lot!