Earlier quoted context omitted.
Sure, JS isn't ideal for compilers, but it is quite good - typescript is a better and more performant compiler than many languages have, as just one example. You wouldn't be crazy for choosing JS for a new compiler project, even for work that had nothing to do with JavaScript. (You would be pretty crazy to choose js to build a rich data science backend, in comparison). I do agree the GC rules out some use-cases like…
Please don't write a compiler, that has nothing to do with JavaScript, in JavaScript. It needs correctness, safety and speed, none of which are JS (nor TS) strengths. You can, but that's a prerogative of all Turing-complete languages. There are much better languages fit for the purpose, which is the point of this comment thread.
Keep in mind "a compiler" may not be for "a widely used general purpose programming language" but something smaller with a specific use, especially in the context of a company.
JS has many quality libraries for parsing grammars etc, and is Fast Enough for the purpose unless you need incredible perf - Python or Ruby, for example, might be much worse choices.
Even C++ might be a worse choice depending on your project's objectives (sure it might be faster but it might be a lot less maintainable, especially compared to TS). I also don't buy the argument that TS would make it harder to write a correct/safe compiler than C++.
Rust and Haskell may be sexy for the purpose but would be much slower to get started with, especially if your team isn't already staffed with experts. The Sorbet team at Stripe chose C++ over Rust because they felt developing with the latter would be too slow.
Keep in mind that most people are sticking with pure-JS build stacks even as esbuild et al are coming on to the scene. And the TS team has stuck with a Node compiler despite having the resources and know-how to use something totally different.
Please don't tell people to avoid writing a compiler in JS/TS unless you really know the specifics. :)
Of course, all of this does make me curious how Nim is for compilers (I imagine it'd be very, very nice).