Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No definition found when ts code is in a subfolder #537

Closed
AndrewSav opened this issue Aug 20, 2015 · 7 comments
Closed

No definition found when ts code is in a subfolder #537

AndrewSav opened this issue Aug 20, 2015 · 7 comments
Labels

Comments

@AndrewSav
Copy link

Hi there!
So I tried to installing atom and atom-typescript to see how it compares with Visual Studio / WebStorm for nodejs web projects. What I immediately noticed is that I'm getting Atom Ts: No definition found.

"What the heck does this mean?" though I. Well after searching the issues here, it became apparent that this is because of missing tsconfig.json. (Could the error message be improved? A user has no fighting chance dealing with this cryptic error message).

But the thing is, my tsconfig.json was not missing. It was there all right. It was working perfectly in WebStorm. What I quickly realized is that atom-typescript expects tsconfig.json at the project root.

I prefer to have all typescript files in a subfolder (as opposed to js, etc). Firstly I feel it's cleaner. Secondly, from time to time ts files appear inside node_modules, and ts compiler (at least in webstorm) dutifully walks the whole tree and compile them. And then complains. I did not want that to happen so I moved all my TS in a subfolder, put there tsconfig.json and it worked perfectly, but not in atom.

How do I configure atom-typescript so that it looks for tsconfig.json in a different place and starts transpiling from that folder? Is it possible to improve the error message?

@basarat
Copy link
Member

basarat commented Aug 21, 2015

Atom Ts: No definition found

That is for if you pres f12 aka goto definition. The message seems right for that.

What I quickly realized is that atom-typescript expects tsconfig.json at the project root

Not true.

How do I configure atom-typescript so that it looks for tsconfig.json in a different place and starts transpiling from that folder?

It looks at all folder above the current open .ts file. This is the way tsc is designed to work as well 🌹

Feel free to discuss any other issues here, we'd be hapy to help 🌹

@AndrewSav
Copy link
Author

Thank you for this. It must have been artifact from very old Atom installation. I removed it completely and reinstalled from scratch, after that all started working as expected.

@jonsamwell
Copy link

I'm also getting this error 'No Definition Found'. It seems to compile the *.ts files fine until I add the 'out' options to the tsconfig.json then it stops compiling the ts files on save. If I press F12 from within a ts file I then get the 'No Definition Found' error.

Here is a simplified version of the project:

root
  models
    modelOne.ts
    modelTwo.ts
 module.name.ts
 tsconfig.json

@jonsamwell
Copy link

Sorry for wasting your time it is working now adding the 'buildOnSave' options then uninstalling and reinstalling atom it is working as expected. Seems odd I had to uninstall though?

@basarat
Copy link
Member

basarat commented Sep 4, 2015

Seems odd I had to uninstall though

You are not on windows are you? #195

@jonsamwell
Copy link

Yeah, that looks like the issue

@javascriptonian
Copy link

I was getting the same problem, but all I did was set "buildOnSave" from false to true, and restart the atom IDE. It was working fine with me without reinstalling.

@TypeStrong TypeStrong locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants