Published on
· Matt Pocock

This TS naming convention is weird

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

Here are my top 4 rules for how to name your types in TypeScript.

Never pluralize: Unless your type is an array type, you should make it singular - even if it's a union of members.

Casing: Choose a different casing between your values and your types. This helps stop syntax highlighting getting confused.

Type Parameters: prefix your type arguments with T. If you've got only one type argument, you can use T. Otherwise, be more descriptive with your parameter names.

Avoid Unnecessary Prefixes: Prefixes like IUser and TOrganization might feel useful, but they're mostly just holdovers from the Java days.

00:00 Intro 00:14 Never Pluralize 01:18 Casing 01:50 Type Parameters 02:44 Unnecessary Prefixes 03:35 Outro

Become a TypeScript Wizard with my free beginners TypeScript Course:

Join the Discord:

Loading transcript…