oliverdavies.uk/source/_daily_emails/2023-01-01.md

21 lines
844 B
Markdown

---
title: >
Types and static analysis saved me today
pubDate: 2023-01-01
permalink: >-
archive/2023/01/01/types-and-static-analysis-saved-me-today
tags:
- static-analysis
- types
---
Today I was writing Pulumi code in Typescript, and I although I have autocompletion, I mistyped the name of a property.
But, because of the types that I'd declared and how I have Neovim configured, the error was immediately shown, and I was able to fix the typo and what would have been a compilation error if I'd tried to run it.
It only took a second or two for me to make and fix the mistake.
I didn't need to run the code or commit it and push it to a CI pipeline to find out that there was a bug.
I found out and fixed it immediately, and moved on as if I hadn't written the typo at all. This is why I like types and static analysis.