-
Notifications
You must be signed in to change notification settings - Fork 202
[typescript2] - Doesn't recognize types installed by npm i @types/something #1054
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
Comments
You're excluding all of node_modules, which is where it would store the types....? |
Welp, that makes sense. Thanks, @DanielJoyce! |
Just in case someone else falls into the same issue, here's how you'd exclude Before: "exclude": [
"node_modules"
] After: "exclude": [
"node_modules",
"!node_modules/@types"
] If you simply remove the |
One can argue about if this is a bug or not. It definitely shows that atom-typescript diverges from the standard tsc compiler results. There are multiple issues regarding more or less to the same problem: |
Thank you @ericmdantas for the tip! That fixes this for me too. I was fighting with this behavior for months now, and I agree it feels like a bug since VS Code, Why does Thanks for the great work on this plugin in general. I hope my comment doesn't come across as ungrateful. =) Cheers. |
Is this still a thing? I'm using version 10.1.9 without any issues any more. |
I'm on the latest of everything pretty much (Atom-TypeScript 10.1.12, Atom 1.12.2, TypeScript 2.0.9, Node 6.9.1, etc.) and yes, this is an issue for me. High-level repro: create a project with Adding I actually don't know (can't explain) why only Atom-TypeScript fails here and others don't also. The Alas, I think the biggest issue here is simply that Atom-TypeScript is differing from every other tool. |
Btw, I also experienced this with |
Sorry, my bad. Tested it with the wrong packages. Looks like type definitions that provide globals like mocha, etc. are affected only. The reason for atom-typescript's different behavior is most likely the way it sets up the "Typescript Language Service". I started to debug this issue once but haven't found any time to do dig deeper. |
Thanks! I hope we can find the answer. One note/update: unfortunately, adding This is happening consistently for me. And I just realized that when this happens, Atom-TypeScript doesn't catch any compilation issues in that file anymore. So... maybe I'll revert adding |
You most certainly want to have Now, to get the global typings like
Typescript builds a compilation context before it can type check anything. It starts with all entry files specified with |
Hey @guncha, thanks for the response. I want to clarify a few things:
I'm sorry if this wasn't clear: I am excluding it, and was not suggesting otherwise. I was talking about explicitly adding
I understand I have these two options. And I completely get your reasoning — it makes sense. But the key issue to me is that I don't need to do either of these for
This might be a start! They indeed appear different. I don't have
I manually set Atom-TypeScript to point to my 2.0.3 Again, I'd just like to emphasize: I'd only like to understand why Atom-TypeScript doesn't behave the same as |
Thanks for debugging. Yes, it seems that Typescript automatically adds everything inside This is done in |
Nice find! Would it be worth re-opening this issue to track this difference now? |
People here may already be aware of this, but this was new to me — here is where it's documented that TypeScript automatically adds everything inside https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types (Note that because of the header on that page, you may have to scroll up a bit.) Given that adding
So at this point, it looks like my options are:
Clearly 1 is the least bad option, but it's sad that it's only needed for Please let me know if there's any other info I can provide to help. Thank you again! |
You just need to specify |
Good idea, thanks. Unfortunately, when I do that, I again get new (but different) errors. These errors don't seem to be related to globals. I sunk an hour debugging the errors to see if they might be legit, but again, This is unfortunately quite exhausting. I wish I knew how to make |
I ran into this same problem and have used The silver lining is that you only need to do this once, so I have a
And that seems to resolve it for all test files. Thanks to @aseemk for listing the options. |
Thanks, can this at least be documented in the readme, since as you noted, Typescript docs say thanks |
I'm working on an update to make |
Sounds good, thanks. I've added a PR in the meantime. |
I wasn't able to work around this bug with atom-typescript, tried all |
@explicitcall another option is |
it doesn't solve the issue that atom-typescript behaves differently than command-line |
@guncha any update with the Fix? |
My short term fix has been to leave out the
Then I've been able to define my custom
Atom-typescript just seems to hate the interaction between |
@jhm-ciberman, I'm glad you asked! #1166 |
First of, amazing job with this package.
So, I have this new project that I'm using
typescript@2
and I decided to give@types
a shot too.I have this test file that depends on jasmine, so I installed the types for it by running
npm i --save-dev @types/jasmine
. It has the following content:If I run
tsc
, it compiles just fine, no warnings, no errors - nothing. But, Atom keeps telling meCannot find name 'describe'.
. So I figured it should be related toatom-typescript
.Info
windows 7, 64bits
1.9.8
10.1.6
Thanks!
The text was updated successfully, but these errors were encountered: