Skip to content

File "not included in the TypeScript compilation context" error on valid tsconfig? #1132

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

Closed
aseemk opened this issue Nov 14, 2016 · 11 comments
Closed

Comments

@aseemk
Copy link

aseemk commented Nov 14, 2016

Hi there,

Great work overall on the plugin! I've been using it for a couple of months now and overall it's very helpful. I've just been fighting with some issues, like #1054 (comment) and this one:

On a new project, I'm getting this error even though tsc does include the file in question.

Here's what my project looks like:

lib/
+ index.ts

test/
+ types.ts

node_modules/
+ @types/
  + ...
+ ...

package.json
tsconfig.json
...

Here's what my tsconfig.json looks like:

{
  "compileOnSave": false,
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "strictNullChecks": true
  },
  "exclude": [
    "node_modules",
    "!node_modules/@types"
  ]
}

As you notice, I only specify exclude, not also files or include. According to the TypeScript docs, this is no problem:

If the files and include are both left unspecified, the compiler defaults to including all TypeScript (.ts, .d.ts and .tsx) files in the containing directory and subdirectories except those excluded using the exclude property.

https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#details

The file in question that's giving me this Atom-TypeScript error is test/types.ts.

The file /path/to/test/types.ts is not included in the TypeScript compilation context. If this is not intended, please check the files or filesGlob section of your tsconfig.json file.

Any ideas what might be causing this? Thanks, and keep up the great work again.

@aseemk
Copy link
Author

aseemk commented Nov 14, 2016

Oh, I forgot to mention I'm on the ~latest version of everything at the time of writing: Atom-TypeScript 10.1.12, Atom 1.12.2, TypeScript 2.0.9, Node 6.9.1, etc.

@aseemk
Copy link
Author

aseemk commented Nov 14, 2016

Also, I searched the existing issues far and wide for the things I'm seeing. In this case, related issues seem to be #681, #558, and maybe a couple of others, but not sure any are exactly this.

If I'm wrong, feel free to close this and merge it into an existing issue. Thank you.

@vrmerlin
Copy link

I'm seeing the identical behavior. It doesn't seem to recognize the include at all, just the exclude, but then I get the same error you got.

@swinc
Copy link

swinc commented Dec 5, 2016

Same issue here.

@slslsls
Copy link

slslsls commented Dec 6, 2016

I had this issue after re-naming a couple files, which made several import statements invalid on other files. After correcting the import statements I was still getting the errors, but when I saved and restarted Atom it was fine.

@isaacg11
Copy link

isaacg11 commented Dec 7, 2016

screen shot 2016-12-07 at 12 27 56 pm

Same issue here, I make sure to include the @types but it gives me the same error:

The file /path/to/test/types.ts is not included in the TypeScript compilation context. If this is not intended, please check the files or filesGlob section of your tsconfig.json file.

@ibqn
Copy link

ibqn commented Jan 28, 2017

I experience the similar limitation and I find it quite annoying

@distante
Copy link

Is there no fix for this? Atom-Typescript keeps complaining that I didn't have my specs files (jasmine) in the context.

@zeves095
Copy link

zeves095 commented Mar 7, 2017

are here any plan to accomplish that issue?

I have project with different files that describe same (a little different) types.
And I have trouble with it - because it add this files in my context:

/tsconfig.json
/libs
/libs/a.ts
/libs/a-alternative.ts

and I got error:
Cannot redeclare block-scoped variable 'myVar'

my tsconfig:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"sourceMap": false,
"noEmitOnError": false, <------ here other trouble with it so I just don't use it
"strictNullChecks":false
},
"include": [
"./libs/a.ts" <------ here I hope I can choose exactly what I want to use... but atom:ts add ./libs/a-alternative.ts too
]
}

@sjordan1975
Copy link

+1 same issue with using "include"

@guncha
Copy link
Contributor

guncha commented Mar 20, 2017

Should be fixed in the latest version (v11) 😄 Please reopen if there's an issue.

@guncha guncha closed this as completed Mar 20, 2017
@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
None yet
Projects
None yet
Development

No branches or pull requests

10 participants