Static typing can be a bitch to get right. There are quite a few weird cases where it would be natural to write without types, but tricky once you introduce static typing and want to keep pleasing the TypeScript type checker, usually involving generics.
That goes away with experience. Typescript can be particularly bad because it has in incredibly complicated type system (to accommodate all the wacky things you can do in JS), but after you get "used to it", the puzzled pauses become fewer and fewer. Eventually it's no inhibition whatsoever, and actually makes you faster because of IDE code completion, refactoring, and bugs caught by the IDE/compiler.
Types don’t affect runtime performance unless you’re changing the algorithm. Maybe you’re arguing that correctly annotating certain algorithms is harder than switching to a slower but easier-to-annotate algorithm, but I’m very skeptical of this, especially since (in my experience) well-typed programs seem to be more efficient (easier for the compiler to optimize types that don’t change at runtime than those that do).
I wasn't talking about runtime performance at all. I was talking about coding speed. (I don't think the commenters before me were talking about runtime performance either? Did I misunderstand?)
I interpreted this as a comment about runtime performance:
> Try vanilla Node/JS if you want a faster Rails.
Understanding now that you meant development velocity (or whichever term), I contest that static typing is in impediment in general, but rather that it's an impediment for people who aren't used to it. Especially for those who don't care if their code is correct or if it only appears to be correct superficially, although someone will inevitably (and authoritatively) drag out some decades-old study which finds no significant benefit to static typing when comparing Python/Lisp to C++89/Java or something.
Dynamically typed, vanilla JS always seems like the faster option at first. Then your team grows, new developers inherit the project, and your codebase needs to be worked on at scale. This is when vanilla JS falls apart and becomes incredibly annoying to maintain, and it's why most of the big tech companies out there do not use vanilla Node JS for large projects.
Types are like living documentation - a contract between devs that describes and enforces specific behavior. Just because you know what properties an object contains now doesn't mean you'll remember it in a month, or that the dev who inherits your work will have an easy time figuring it out. I feel way faster when I code using types, because the type system tells me exactly what I'm working with at a given time. This ends up preventing lots of bugs and makes debugging errors that do happen way easier, in my experience.
So TL;DR types seem slower at first but the dividends are paid in full, and then some, when you have to maintain a project among many devs or teams of devs.
EDIT: not to mention that IDE autocomplete features often seem like a superpower when working with static types. I'd recommend Typescript for that reason alone, honestly.
Relying on the type system for code insight and bug catching means one have not carefully studied the code, which is what causes most bugs. If the code base is too large for anyone to digest, then break up responsibility.