Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Note that tsc fails with certain argument options #757

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pages/Compiler Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Option | Type | Default

* <sup>[1]</sup> These options are experimental.
* <sup>[2]</sup> These options are only allowed in `tsconfig.json`, and not through command-line switches.
* Due to a limitation in the argument parser, `tsc` will [fail](https://github.com/Microsoft/TypeScript/issues/18581) on the command line if its last argument is one that can take multiple options (like `--types`) but none are passed. As a workaround you can add another argument at the end, e.g. `tsc --types --pretty`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i do not think this is how i would describe the behavior.. it is a feature and not a bug really. it is a command line parser, so not sure what your expectations are for passing flags that expect a value but do not want to pass a value for them..

Copy link
Author

@IceCreamYou IceCreamYou Apr 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is how I think about this: the compiler itself does not require that any types are passed, which I know because it works to pass an empty array in a tsconfig. There is no way to specify an equivalent command on the command line. That is what I'm trying to describe here.

Put another way, I don't think the --types flag in particular should require a value on the command line. I'd be fine with any of the syntaxes explored in microsoft/TypeScript#18581 for achieving that.

Or I'm happy to change the description here to clarify the behavior.

Copy link
Author

@IceCreamYou IceCreamYou Apr 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, @mhegazy, I used your words from the original issue to describe the behavior: "this a limitation in our commandline parser."

Additionally, the fact that passing no value for --types appears to work if there is another parameter after it supports the idea that this is a valid/expected use case that the argument parser handles incorrectly.


## Related

Expand Down