Published on
· Matt Pocock

Should you use return types?

This post is auto-generated from a public YouTube video for personal study notes. It is not an endorsement. The transcript is machine-derived and may contain errors; refer to the original video for accuracy.

About this video

Your default attitude towards return types should be 'don't use them', unless one of three things are true:

  • You're writing a function with multiple branches - You're building a library - You have a specific TS perf concern and you're banging your head against the wall

Become a TypeScript Wizard with Matt's free TypeScript Course:

00:00 What is a return type? 00:49 Should you use them? 01:08 Multiple branches in functions 02:32 Library code 03:10 Performance

Loading transcript…