microsoft / microsoft/TypeScript

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

Offen
#33,545 2 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@RyanCavanaugh arbeitet bereits daran.

Seit 25.9.2019.

Docs
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

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:

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.