File not included in TypeScript compilation context

Using Atom Editor with typescript plugin I get the following error:

Error The file "D: /foo/app/classes/event.class.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.at file line 1 col 1

The contents of my tsconfig.json file:

{ "compilerOptions": { "target": "es5", "module": "commonjs", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": false }, "exclude": [ "node_modules", "typings/main", "typings/main.d.ts" ] } 

I looked at a few others who had this problem. This: https://github.com/lathonez/clicker/issues/4 made me try to create the "files" array in the tsconfig.json array. This, as with the person on another topic, did not help. Please note that this thread talked a lot about testing ... which is not applicable to me.

I also tried to sort this topic out: https://github.com/TypeStrong/atom-typescript/issues/558 , however it was mostly an argument about cleanliness and pragmatism. I realized that if the files and files of the Glob arrays are missing, the hidden "all" globe is used. If so, why am I getting an error message? I do not have a file and file. Record as a string.

Aside from the command line, TSC generates compiled js and map files just fine .... but I still need to see a big red error in Atom.

For what it's worth, the event.class.ts file looks like this (I do not expect this to be the source of the problem, but suggested that I would include it for completeness):

 import {Utilities} from '../utilities'; export class Event { eventData:JSON; eventID:string; constructor(_eventData:JSON, _eventID?:string) { if(_eventID==null) { _eventID=Utilities.newGuidPlus(); } this.eventID = _eventID; this.eventData = _eventData; } getEventData():JSON { // returns the full event return this.eventData; } getEventID():string { return this.eventID; } } 
+7
typescript atom-editor tsconfig
source share
3 answers

For the exact problem in my case, I included the property "**/*.ts" in "filesGlob" in tsconfig.json . The whole tsconfig.json looks like this.

 { "compileOnSave": false, "compilerOptions": { "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, "mapRoot": "/", "module": "commonjs", "moduleResolution": "node", "noEmitOnError": true, "noImplicitAny": false, "outDir": "../dist/", "rootDir": ".", "sourceMap": true, "target": "es5", "inlineSources": true }, "filesGlob": [ "**/*.ts" ], "atom": { "rewriteTsconfig": false } } 
+9
source share

In my case, the solution was different:

  • Make sure ALL files in your project have ALL records that are well written. (Case sensitive)
  • Save all files. Close Atom. Reboot the computer. (not necessary)
  • Open Atom again. Done. :)

I will update if something else happens with this error.

+7
source share

Just ran into this problem with atom , in my case the ts file in the hidden directory was not compiled. Explicitly adding the path to tsconfig.json resolved the issue:

 "filesGlob": [ "**/*.ts", ".serverless_plugins/**/*.ts", "!node_modules/**" ], 
+3
source share

All Articles