#Why Does TSC ignore "outDir" in tsconfig.json when run with a filename param?

5 messages · Page 1 of 1 (latest)

static crystal
#

I'm following a course, and it first showed me how to use the tsc option --outDir to specify where the compiler writes its compiled code. The it showed me how to use the tsc --init to create a tsconfig.json file, and then how to uncomment "compilerOptions": "outDir": "./dist", to tell the compiler where to always write output to for this app.

Yet after doing that, when I run tsc app.ts, it writes app.js straight to the root directory of the app, right next to app.ts. Only when I run it without a filename, just as tsc, i.e. for all files, does it create and output to dist. Even after dist exists, running tsc with a filename makes the compiler output the file to the root of the app.

minor cedar
#

!:tsc%

#

!:tsc%

frail nexusBOT
#
gerrit0#0
`!gerrit0:tsc-files`:

When you provide tsc with a file like tsc index.ts, TypeScript will ignore your tsconfig.file. TypeScript will compile all of your files as specified by the include option (https://www.typescriptlang.org/tsconfig#include) if you don't provide any files on the command line.

minor cedar
#

@static crystal ^