Closed RamoFX closed 3 years ago
Any idea?
Sorry, I was busy with day job when I've seen the notification, and then I kinda forgot.
So... yeah, this is by design. The idea is, TypeScript server traverses the directory tree upwards to find tsconfig
, that is, if you take a given source file, e.g. /home/user/github/awesome-project/src/client/index.ts
, tsserver will look for tsconfig
in /home/user/github/awesome-project/src/client/
, /home/user/github/awesome-project/src/
, /home/user/github/awesome-project/
, /home/user/github/
, etc. Obviously, upwards traversal takes linear time. Looking for tsconfig
in the whole directory tree on the other hand is in worst-case scenario equivalent to enumerating all files over the whole of the filesystem. Not viable.
I mean, if you really have to, I guess you could "trick" tsserver into using a given tsconfig file. But you'd need some generic way of telling it where to look in the first place, which would boil down to having a config file in the root of the project or something similar, which defeats the purpose.
A quick hack is to add tsconfig.json
at the root of the project with an extends
field pointing to actual tsconfig
location, e.g.
{
"extends": "./relative/path/to/actual/tsconfig.json"
}
Thank you very much for the advice!
It would be awesome if there will be no configs in the root, but this is about how the project's structure design have been made. I am sorry, I didn't catch that this is more Typescript server's "issue".
It's the shame, that there is no atom per-project config. For example:
# project.atom-config.cson
'atom-typescript':
tsconfig:
type: 'file'
source: '/some/path/to/the/config/tsconfig.json'
Hello,
The problem
I am configuring my project (repo) and I found the best structure for my needs. But
atom-typescript
package can't find mytsconfig.json
, no errors when webpack compiles and bundles my code withtsconfig.json
loaded.Additional information
Atom version: 1.53.0
atom-typescript
version: 14.1.2atom-typescript
settings: default, only setprefer built-in type tooltips
to trueMaybe some kind of inspiration
I am working with webpack and give a
tsconfig.json
path to thets-loader
's options and eveything works!Possible solutions
What I have to do to fix it? Is it a bug?
Maybe you can add some feature to auto-find
tsconfig.json
or make project's owntsconfig.json
path?Reproduce
tsconfig.json
in/PROJECT_ROOT/frontend/configs/typescript/tsconfig.json
atom-typescript
can't findtsconfig.json
Screenshots
Errors in editor
tsconfig.json
Webpack console output while dev