microsoft / microsoft/TypeScript

Documentation for --declaration and -d incorrect, missing --dry

Open
#33,545 2 comments 0 reactions 1 assignee View on GitHub

@RyanCavanaugh is already working on this.

Since Sep 25, 2019.

Docs
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

When I read the Compiler Options docs (source permalink)[https://github.com/microsoft/TypeScript-Handbook/blame/ee314075d47dbab49a6b631cc45a38d6c555b324/pages/Compiler%20Options.md#L16], I see:

Option Type Default Description
--declaration
-d
boolean false Generates corresponding .d.ts file.

When I try to specify --declaration as a compiler option on the command line, it gives an error. When I try to specify -d as a compiler option on the command line, it seems to activate an undocumented --dry option.

I think tsc needs to be fixed to follow the behavior specified in the documentation or the documentation needs to be updated to describe the --dry compiler option.

Furthermore, by reading the source, I can see that there seem to be config-only compiler options and CLI-only compiler options. The documentation probably needs to be updated to describe how those work/interact and describe when they are different. When a compiler option is config-only, it should never be documented as --optionName because a config-only option will never ever be typed as --optionName.

TypeScript Version: 3.7.0-dev.20190922

Search Terms:

  • is:issue is:open declaration dry

Code

$ ./node_modules/.bin/tsc -b --declaration
$ ./node_modules/.bin/tsc -b -d

Expected behavior:

Build with .d.ts files emitted.

Actual behavior:

ohnobinki@gibby /tmp/.private/ohnobinki/typescript-next-play $ ./node_modules/.bin/tsc -b --declaration
error TS5072: Unknown build option '--declaration'.

ohnobinki@gibby /tmp/.private/ohnobinki/typescript-next-play $ ./node_modules/.bin/tsc -b -d
[00:31:11 GMT+0000 (UTC)] A non-dry build would build project '/tmp/.private/ohnobinki/typescript-next-play/tsconfig.json'

Playground Link: n/a

Related Issues:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.