Workshop about Typescript
This is a workshop I made on Wallbox about Typescript.
Resume
- Currently, we have plenty of tools and techniques in order to avoid mistakes in our base code.
- Anyway, our apps still have bugs.
- By the way, some of that bugs are typed-related.
- No problem! We are humans, and the humans make mistakes.
Ways to avoid mistakes in our code base
- Linter and code formatter: ESLint
- Code quality tools: Sonar Cloud
- Code documentation
- Application monitoring and error tracking: Sentry, Datadog or New Relic
- Unit, Integration & E2E testing
- Code review & pair programming
- QA team
- AI pair programming: Github Copilot, Tabbing, and Kite
Strong & Static Typed Languages
Good parts
- Your code is safer
- Your code is more readable
- Your code is easier to analyse
- Your code is more understandable
- Better support of your IDE
- You can catch some typed-related errors early
Bad parts
- Your code is too verbose
- Your code is too complex
- Compilation speed
- Steep learning curve
- You need to think in types
- Rigid way to programming>
Good things about Typescript
- Catches errors at compile-time
- Provides documentation
- Allows IDE to flag errors while typing and provides completion
- Makes refactoring less error-prone
- Makes some unit tests unnecessary
- Disallows many JavaScript type coercions
- Type inference
- Optionally types: any
- Semantically compatible with JavaScript
- Fully support any IDE
- Framework support
So, should I use Typescript?
- Your app has a substantial amount of algorithmic code.
- People enter or leave your team frequently.
- Your app is crucial for the success of your company.
- There is a chance you will need to refactor it.
- Your team have experience with strong/static typed languages such as Java or C#