microsoft / microsoft/TypeScript

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

Ouverte
#33,545 2 commentaires 0 réactions 1 personne assignée Voir sur GitHub

@RyanCavanaugh y travaille déjà.

Depuis le 25/9/2019.

Docs
Langage dominant
Go
Étoiles
111k
Forks
14.3k
Merge moyen
1 j 19 h
PR mergées (30 j)
117

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:

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.