Skip to content

Specify a tsconfig.json for use with tsc on the command line #5858

@IceDragon200

Description

@IceDragon200

Expected:

# works like normal, loads ./tsconfig.json
tsc
# specifying a different tsconfig
tsc --config /path/to/a/tsconfig.json

# example: specifying different config files 
tsc -c /configs/typescript/es3-commonjs.json --outDir ./build/es3
tsc --config /configs/typescript/es5.json --outFile ./build/production.js
tsc --config /configs/typescript/es6-experimental.json --outFile ./build/staging.js

# the order of the parameters should be respected, configs are loaded and their options overloaded 
# by the ones specified on the command line
tsc -c config.json --outDir ./build
# in this case, the config is loaded, and its outDir is overriden if defined
tsc --outDir ./build -c config.json
# outDir is set, but overriden by the config if set

If tsc is able to load a tsconfig.json, why can't I specify what to load?

Certainly I could use the @text.txt format, but that's no fun, I even tried tsc @tsconfig.json only to be met with errors (you couldn't extract the extension from the filename and just load it as a json file, like really?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions