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

Conversation

IceCreamYou
Copy link

Documenting the conclusion of microsoft/TypeScript#18581

@@ -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.

@RyanCavanaugh
Copy link
Member

We don't need to document every single possible minutae about the commandline parser here. It's a guide, not an exhaustive specification.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants