Breaking Changes
The library no longer contains TypeScript enums in favor of union types.
Before:
export enum UsersUserRelation {
NOT_SPECIFIED = 0,
SINGLE = 1,
IN_A_RELATIONSHIP = 2,
ENGAGED = 3,
MARRIED = 4,
COMPLICATED = 5,
ACTIVELY_SEARCHING = 6,
IN_LOVE = 7,
IN_A_CIVIL_UNION = 8,
}After:
export const UsersUserRelationEnumNames = {
NOT_SPECIFIED: 0,
SINGLE: 1,
IN_A_RELATIONSHIP: 2,
ENGAGED: 3,
MARRIED: 4,
COMPLICATED: 5,
ACTIVELY_SEARCHING: 6,
IN_LOVE: 7,
IN_A_CIVIL_UNION: 8,
} as const;
/**
* @note This enum have auto-generated constant with keys and values
* @see UsersUserRelationEnumNames
*
* `0` — not specified
* `1` — single
* `2` — in a relationship
* `3` — engaged
* `4` — married
* `5` — complicated
* `6` — actively searching
* `7` — in love
* `8` — in a civil union
*/
export type UsersUserRelation = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;All numeric JSON Schema enums have auto-generated constants with keys and values. This constants allows to use not magic numbers in code, but some understandable values.
/* What `5` means? */
if (relation === 5) {}
/* Looks better */
if (relation === UsersUserRelation.COMPLICATED) {}