microsoft / microsoft/TypeScript

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

未关闭
#33,545 2 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@RyanCavanaugh 已经在做这个了。

开始于 2019年9月25日。

Docs
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

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:

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。