EDIT at the bottom of the question - added more info.
I'm compiling my TypeScript project in Visual Studio Code via Ctrl+Shift+B (uses tsc under the hood as far as I understand), I have a tsconfig.json.
My project has many folders and subfolders with .ts files.
I'd like to include all the .ts files in my project without any reference path tags, and in the right order so that I don't get the error "Class % used before its declaration.".
It seems it is possible and has already been solved before on StackOverflow:
Do I have to reference typescript definition in every file
UPDATE for TypeScript >= v1.5: you can use a tsconfig.json file, and the compiler will get the ordering of the classes right. This removes the need to use gulp-typescript alltogether. You can either chose to have all files explicitly listed in the tsconfig.json file, or completely leave out the files property to include all .ts/.tsx files within the directory the tsconfig.json resides (including all subfolders).
However applying their solution doesn't seem to solve it for me, I'm not sure what I'm not doing right.
I removed all the reference path tags from my project, and in my tsconfig.json I tried:
a. Not specifying "files"
b.
"files": [
"*.ts/*.tsx"
]
c.
"files": [
"**/"
]
which recursively goes over all subfolders according to: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
In all cases I'm getting "Cannot find name %." and "Class % used before its declaration." all over my project.
This is my tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"removeComments": true,
"preserveConstEnums": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"outFile": "../src/app.js"
},
"exclude": [
"lib"
]
}
What am I not doing right?
Is it really supposed to work automatically or is there something else I need to do?
I'm using the latest TypeScript.
I removed the module parameter in compilerOptions in order to be able to specify a single outFile, perhaps that's the problem?
Maybe if I used a module like commonjs it'd have worked?