0

I have two folders: TypeScript and JavaScript. I need to compile the TypeScript file which are in TypeScript folder to JavaScript files in the JavaScript folder.

fzzle
  • 1,466
  • 5
  • 23
  • 28
  • Use the building tool of your preference. (grunt, gulp, ...) – Shilly Sep 26 '16 at 15:27
  • @Shilly Thanks alot :D –  Sep 26 '16 at 15:29
  • The way to do this is to read the manual. Or you could google "typescript target directory". Or you could search SO for answers like [this](http://stackoverflow.com/questions/24454371/typescript-how-to-keep-compiled-files-in-a-separate-directory). –  Sep 26 '16 at 17:48

2 Answers2

-1

--outDir string Redirect output structure to the directory.

tsconfig reference

ASDFGerte
  • 4,695
  • 6
  • 16
  • 33
-1

Add a tsConfig.json file to the root of your TypeScript project. One option to the compiler is outDir which specifies the output directory. See: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

{
    "compilerOptions": {
        "outDir": "./JavaScript"
    },
    "files": ["./TypeScript/**/*.ts"]
}
Hampus
  • 2,769
  • 1
  • 22
  • 38
  • tsConfig.json file must be present in the typescript folder ? –  Sep 26 '16 at 15:42
  • @an0nh4x0r It should be in the root of your TypeScript project. See https://www.typescriptlang.org/docs/handbook/tsconfig-json.html – Hampus Sep 27 '16 at 07:13