diff --git a/src/constants/errorCodes.ts b/src/constants/errorCodes.ts index 069a9e7..7eb701f 100644 --- a/src/constants/errorCodes.ts +++ b/src/constants/errorCodes.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ + export const ERROR_CODES = { MONGODB: { MISSING_URI: "MONGODB_MISSING_URI", @@ -82,4 +84,7 @@ export const ERROR_CODES = { }, } as const; -export type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES][keyof typeof ERROR_CODES[keyof typeof ERROR_CODES]]; +type Values = T[keyof T]; +type ErrorCodeValues = T extends { [key: string]: infer U } ? U extends { [key: string]: string } ? Values : never : never; + +export type ErrorCode = ErrorCodeValues;