Why we write JavaScript (and not TypeScript) at Dashcam

If you use JavaScript daily and don’t live under a rock, you might have seen DHH’s recent Twitter announcement: they’re dropping TypeScript from Turbo 8.

Foreword

TypeScript is good when you’re in a large codebase in production with a lot of collaborators. With that said, writing types is extra work. It takes more time and code to add all the type annotations. It start to feels annoying and slows you down, mainly when you write code that changes all the time, like at a startup.

If you like refactoring your code rapidly, you don’t need the burden of types. JavaScript’s dynamic typing gives you the freedom you need.

Errors

TypeScript provides the benefit of compile-time type checking, a chance to catch and rectify errors during development, which prevents a lot of runtime bugs in production.

What it doesn’t protect you against is bad logic. You can still have logical errors, runtime exceptions, etc. So you don’t get complete safety just by adding types.

Developer Experience

I feel like the tools make or break the JavaScript writing experience. Configuring TypeScript and setting up the build pipeline requires more initial setup work before you can start coding. It’s like instant-ramen vs a complicated 3 course meal. If you want to get food in your body, you’re good with instant-ramen.

Debugging can be harder in TypeScript code since you have to correlate it back to the original TS source. Debugging in JavaScript is more direct.

As a developer, reading TypeScript is more cumbersone: there is more visual noise in the code from type annotations that clutters the reading experience. JS code looks cleaner.

Why we don’t currently use TypeScript (for now)

Dropping TypeScript from Turbo 8 has got the whole JavaScript/TypeScript world talking. TypeScript isn’t perfect, but it’s a tool that offers some tangible advantages at the cost of speed and flexibility.

You have to ask —do you really need types? If yes, TypeScript, might the answer. If not, stick with JavaScript. TypeScript adds conceptual overhead. Understanding types, interfaces, generics etc takes time, JavaScript is simpler to use. At an early stage startup you want to use tools that give you that dynamicity, so we’re sticking with JavaScript right now.

Leave a Reply

Discover more from Dashcam

Subscribe now to keep reading and get access to the full archive.

Continue reading