Common Types

Many LiveMarket entities share common types like IdType or Image. Here is a reference of those.

IdType

An id of an object. Every id can be either a string or a number.

type IdType = number | string;

Image

A single image from the API.

type Image = {
  url: string;
  alt?: string;
};

Money

An amount of money in a given currency.

type Money = {
  currency: string;
  amount: number;
};

TaxedMoney

Amount of money including tax - gross, net and tax.

type TaxedMoney = {
  currency: string;
  gross: Money;
  net: Money;
  tax: Money;
};

TaxedMoneyRange

A range of money includeing tax.

type TaxedMoneyRange = {
  start?: TaxedMoney;
  stop?: TaxedMoney;
};

User

A user.

type User = {
  id: IdType;
  firstName: string;
  lastName?: string;
  avatar: Image;
};

Weight

Weight of a real-world object.

export type Weight = {
  unit: string;
  value: number;
};