microsoft / microsoft/TypeScript

Allow prepending --watch with --clean in CLI --build mode?

Open
#43,193 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Suggestion

🔍 Search Terms

tsc watch build clean

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

It would be nice to be able to run tsc --build --clean --watch and have the --clean operation run before the --watch operation. Today we have to run these commands separately.

📃 Motivating Example

For developing TypeScript itself, I'll frequently run tsc -b src/tsc -w to get built/local/tsc.js created. But other commands such as gulp runtests seem to clobber over the inputs and/or outputs so I've found I need to first tsc -b src/tsc --clean when running them.

💻 Use Cases

In general, this would be a nice little shortcut for folks who want to first clean, then watch.

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.

Research direction

Start at the tsc CLI handling for --build, --clean, and --watch, and trace how these options are currently combined or rejected. Done means tsc --build --clean --watch cleans first and then enters watch mode, while existing command behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.