Skip to content

Type Naming Conventions

[!When to have a plural type name?]- only for arrays

[!Why should types always be Pascal case?]- so the syntax highlighter doesn't get confused


  • T
  • or prefixed with T
    • TData
export type Response<T, U> = {
  data: T
  error: U

[!Better generic name]-

export type Response<TData, TError> = {
  data: TData
  error: UError

Why isn't this good?

type TUser = {
  id: string;
  name: string;

interface IUser {
  id: string;
  name: string;

What if you want to turn an interface into a type? - or vice versa? - unnecessary refactoring - just hover over to see the type definition

Last update: 2023-04-24