Skip to content

tsc -watch should ignore files without extensions, pretends to hang during compilation instead #46949

Closed
@mkhl

Description

@mkhl

Bug Report

🔎 Search Terms

  • watch
  • extension
  • change
  • detected

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about ...watching files?
  • I was unable to test this on prior versions because I haven't used typescript in a while
  • This behavior is present in typescript nightly 4.6.0-dev.20211126

⏯ Playground Link

mkhl/issue-tsc-watch-should-ignore-files-without-extension (branch next for typescript nightly)

A playground won't work because it's not the handling of typescript code that's problematic but of other additional files

💻 Code

🙁 Actual behavior

  1. tsc -watch -p ./
  2. touch foo or mkdir
  3. tsc output:

    File change detected. Starting incremental compilation...

Note that touching a relevant file (like index.ts results in normal output resuming).
Note also that with this behavior, the user and tools that scan tsc output, like visual studio code, may assume that they have to wait for tsc to finish compilation.
(That's in fact what vscode does, which led me here.)

🙂 Expected behavior

Since a file without an extension or an empty directory don't require recompilation, tsc should ignore them and not output anything.
It already handles files with irrelevant extensions this way (like foo.txt).

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions