Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Use objects instead of enums #140

@targos

Description

@targos

For example, convert:

export enum ImageColorModel {
  GREY = 'GREY',
  GREYA = 'GREYA',
  RGB = 'RGB',
  RGBA = 'RGBA',
  BINARY = 'BINARY',
}

to:

export const ImageColorModel = {
  GREY: 'GREY',
  GREYA: 'GREYA',
  RGB: 'RGB',
  RGBA: 'RGBA',
  BINARY: 'BINARY',
} as const;
export type ImageColorModel = typeof ImageColorModel[keyof typeof ImageColorModel];

This allows to use the enum values without importing the enum object.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions