I prefix is used for interfaces

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the types category.

Last Updated: 2024-11-23

When browsing through the Project M code I was thrown by entities with names like IConnectionOptions. Referring to the source definition, I saw that these were in fact interfaces

export interface IConnectionOptions {
  database: string
  host: string
  password: string
  port: number
  username: string
  synchronize?: boolean
}

The actual ConnectionOptions type was defined elsewhere

export class ConnectionOptions {
  @IsString()
  public database: string

  @IsString()
  public host: string

  @IsString()
  public password: string

  @IsString()
  public username: string

  @IsNumber()
  public port: number

  @IsOptional()
  @IsBoolean()
  public synchronize?: boolean
}