The idea that you must retire from tech before 50 is so incredibly false I have difficulty believing this view is even shared here.
Perhaps in some of the "trendy" "bro-culture" startups you'd have a more difficult time as an older developer but even in those places, the level of experience and skills older devs bring can be extremely valuable.
But say you were laid off in your 40's, now what? Well, there are so many bigger, less volatile companies out there with solid pay that are desperate for senior people with experience. There's also consulting for those who have spent a career building up a network of contacts. You can still leverage those old contacts for future opportunities as well.
Governmental work and such is also a place where age is not a concern. Here I agree you might not make as much money but employment is always available to developers who are skilled, experienced and flexible.
Perhaps in some of the "trendy" "bro-culture" startups you'd have a more difficult time as an older developer but even in those places, the level of experience and skills older devs bring can be extremely valuable.
But say you were laid off in your 40's, now what? Well, there are so many bigger, less volatile companies out there with solid pay that are desperate for senior people with experience. There's also consulting for those who have spent a career building up a network of contacts. You can still leverage those old contacts for future opportunities as well.
Governmental work and such is also a place where age is not a concern. Here I agree you might not make as much money but employment is always available to developers who are skilled, experienced and flexible.