The question seems off since it is pitting JS against TS. As if you can only really work with one.
However, any JavaScript developer can convert to a TypeScript developer. It took me a week of reading the official handbook during coffee breaks. That is enough to make you familiar with the syntax, goals, and approach in TypeScript. When you already know JavaScript, you already have the foundation needed to write code. It then just takes practice to hone these skills but that is true for everything.
If you are starting with TypeScript and never knew JavaScript - it still matters little. Most of the code you would write will be JavaScript code. You need the knowledge and skill to write JavaScript code anyway.
For medium-to-large backend applications, which one tends to be more maintainable in the long run — TS or JS?
TypeScript hands down. If you are really disciplined, you can of course maintain a large JavaScript code base. If you have a team, you need everybody to be disciplined.
TypeScript lowers the mental overhead of working with code a lot. Not that you should be sloppy when writing TypeScript. But it you require a lot less rigour, since the types and expectations are communicated a lot more clearly than...not communicated at all.
Does TypeScript introduce noticeable overhead (in build time or complexity) for a Node.js backend?
No. You might need to set up your toolchain but that is also true for JavaScript. Any non-trivial project will have some sort of build step and tooling. Adding TypeScript to it is unlikely to be significant. Even plain JS will need to be scanned, bundled, minified, chunked, probably transpiled (could even go through several transpilations).
And if you do not have a complex setup already, then all you really need is to use the TypeScript compiler. Configure the options and make it output the files where you expect them. It can be as simple as setting up the config and adding a script in package.json.
Are there any major ecosystem or library compatibility issues when using TypeScript in Node.js (e.g., with Express, Prisma, or Sequelize)?
No. Although some libraries do not ship with types support. Nowadays, it is less and less, since the DefinitelyTyped project is focused on providing type definitions for all popular libraries. Still, you might find some less popular ones that do not have up to date or high quality type definitions. But any type definitions is usually better than none and you can fill in whatever you need as you need it.
From a hiring and collaboration perspective, are most modern Node.js teams moving toward TypeScript?
Honestly, I would be extremely suspicious of any team that outright denounces TypeScript. There are cases where you might not want TypeScript but these will be very few and far between.
- Some older JS-first codebases might have issues transitioning to TS. Now, these are not insurmountable issues and TS can be gradually introduced in a project. But it might be a valid reason to not have TS yet.
- Some projects might be lead and developed by JS experts. This would fall under the team being really disciplined. At certain level, there are a few things that are hard to express in TypeScript. Things like curried functions of higher arities, for example. They could be expressed but if you are working with such code already and you are working well with it, conversion to TS might be unneeded.
- Also a valid reason might be keeping the complexity of projects low. If the codebase is easy to understand, TS might not be needed. This might be another case of really disciplined team.
- A team might rely on another tool for types. Flow is an alternative to TypeScript - it has fewer features but it tries to do a lot less - just type checks. It also has features TS does not, like [nominal typing out of the box], exact types, as well as better variance support. A team could definitely elect to use Flow instead of TypeScript but for the same function as it. There are other tools there in this space as well - in the past before TypeScript established itself, I have used Tern.js with JSDoc and plain JS code.
However, in most other cases I would expect and team that can work with JS to be able to work with TS. And vice versa. The two skills are complementary, not in opposition to one another.