MarkoSulamagi / Screeps-typescript-skeleton

Screeps typescript project skeleton
https://screeps.com
6 stars 5 forks source link

tsconfig.json - "files" and "exclude" are mutually exclusive #8

Closed staff0rd closed 8 years ago

staff0rd commented 8 years ago

See https://github.com/Microsoft/TypeScript/wiki/tsconfig.json#details

Propose moving tsconfig.json to /src instead

staff0rd commented 8 years ago

I believe that globs in "files" is also not valid. To get this to work in Visual Studio Code, I had to move tsconfig.json to /src and add a new file, _references.ts to hold /// <references to the typescript definitions.

MarkoSulamagi commented 8 years ago

I'll look into it tomorrow.

MarkoSulamagi commented 8 years ago

1) I don't see the reason to move the tsconfig file to src dir. I think since it's configuration file that also points to other folders (node_modules and typings) it should remain in root.

2) You're right about files and exclude being mutually exlusive. I'll fix that.

3) About the /// reference tag. It should be obsolete with the coming of tsconfig.json, but for some reason Visual Studio Code still requires it (at least for me, when running on linux). I got the intellisense working in VSCode by keeping the tsconfig.json in root directory and creating _reference.ts file. I'll also add it to skeleton so people with VS Code don't have this error anymore. Just to mention that this is not a problem with JetBrains.

staff0rd commented 8 years ago

The reason I usually put tsconfig.json in /src is because files doesn't support globs, meaning you either have to include everything except for exclude or list every typescript file you want in files. The former + references seems alot less annoying than having to make references to every *.ts file you want...

MarkoSulamagi commented 8 years ago

Hmm, i researched a bit and got confused. Am I doing something wrong in tsconfig?

If files property in my tsconfig.json is using glob, then why is it working.

"files": ["./src/**/*.ts", "./typings/**/*.ts", "./node_modules/screeps-typescript-declarations/dist/screeps.d.ts"],

staff0rd commented 8 years ago

That works due to the tsconfig.json implementation of tsproject. However that syntax is not yet supported by typescript, so it is not guaranteed to work outside tsproject (for example in vscode or using the typescript compiler directly).

MarkoSulamagi commented 8 years ago

That makes sense. Since this skeleton is quick-start, then I think relying on tsproject is ok right now. Intellisense works now in VSCode thanks to reference file. If someone wants to compile project not using tsproject then they need to modify it a bit.

We'll see where Typescript takes us with this globs thing.

Thanks for explaining.

staff0rd commented 8 years ago

Yeah fair enough.