Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tsc): allow the --appendCommand option to be added in --watch mode #55599

Closed
5 tasks done
KostyaTretyak opened this issue Sep 1, 2023 · 4 comments
Closed
5 tasks done
Labels
Duplicate An existing issue was already created

Comments

@KostyaTretyak
Copy link

KostyaTretyak commented Sep 1, 2023

πŸ” Search Terms

  • watch mode
  • extend watch

βœ… Viability Checklist

  • 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 our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals

⭐ Suggestion

After compiling in --watch mode, tsc should be able to pass the baton to the next command (probably in a child process) that the user passes with the --appendCommand option. After tsc detects a change in the source files, it should terminate the process in which it started the command from the --appendCommand option. After that, it should make a new iteration of the pair:

"compile -> execute the command from the --appendCommand option".

Of course, the output from the --appendCommand should be displayed below the tsc output. On error, tsc should not run the command with --appendCommand.

πŸ“ƒ Motivating Example

Currently, users have to use two terminals: one for tsc --watch and one for nodemon dist/main.js. Yes, of course I know about pair nodemon + ts-node, but tsc with --appendCommand can work better.

πŸ’» Use Cases

Users will be able to get native compiler support with native Node.js operation in one terminal:

tsc -b --watch --appendCommand 'node dist/main.js'
@MartinJohns
Copy link
Contributor

MartinJohns commented Sep 1, 2023

Related: #33388 / #49225

@MartinJohns
Copy link
Contributor

Duplicate of #35398.

@KostyaTretyak
Copy link
Author

I hope that since 2019, the opinion of the TypeScript team has changed. This is quite simple to implement and will greatly simplify work with tsc.

@andrewbranch andrewbranch added the Duplicate An existing issue was already created label Sep 1, 2023
@typescript-bot
Copy link
Collaborator

This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants