outDir in tsconfig

the compiled js files are not moving into the specified folder

β€œes6” isn’t a valid target, look at the list of possible targets in the comment right next to it. β€œes6” isn’t a thing in JS, it’s es2015, es2016, etc. β€œes6” was the original name and is something that still gets used when people write about it (because the previous version was es5), but it isn’t an actual version.

Also, no root dir specified (although it will default to src). Difficult to tell much else without seeing folder structure

fixed the β€œes6” to ES2015
changed the ts config
what is the possible problem now ?

file structure

E:\GitHub\typescript>tree
Folder PATH listing for volume data
Volume serial number is B4F6-55A7
E:.
└───js

modified config

   "outDir": "./js" 
    "rootDir": "./"

compiling using

tsc <file_name>.ts

should be like:

my project/
└─── src/
     └─── someFile.ts
     └─── anotherFile.ts
     └─── indexFile.ts
└─── tsconfig.json
└─── package.json

Then just run tsc, rootDir should be src/, outDir should be specified, normally would be [conventionally] lib/ or dist/

1 Like

I get it,In this case all the files are compiled and then we run then I have a different requirement like I want to run single file at once and thaαΉ­ file should be saved into the js folder

So you’ve installed Typescript globally?

tsc my-file.ts --outDir ./js
1 Like

yes, great it work !!
why I could not find it on internet :thinking:

1 Like