codigo0/node_modules/date-fns/locale/_lib/buildLocalizeFn.d.mts
planetazuzu 5d7a6500fe refactor: Fase 1 - Clean Architecture, refactorización modular y eliminación de duplicidades
-  Ticket 1.1: Estructura Clean Architecture en backend
-  Ticket 1.2: Schemas Zod compartidos
-  Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares)
-  Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares)
-  Ticket 1.5: Eliminación de duplicidades (~50 líneas)

Cambios principales:
- Creada estructura Clean Architecture en backend/src/
- Schemas Zod compartidos en backend/src/shared/schemas/
- Refactorización modular de drugs y procedures
- Utilidades genéricas en src/utils/ (filter, validation)
- Eliminados scripts obsoletos y documentación antigua
- Corregidos errores: QueryClient, import test-error-handling
- Build verificado y funcionando correctamente
2026-01-25 21:09:47 +01:00

103 lines
2.8 KiB
TypeScript

import type { Day, Era, Month, Quarter } from "../../types.js";
import type {
LocaleDayPeriod,
LocaleUnitValue,
LocaleWidth,
LocalizeFn,
} from "../types.js";
export type BuildLocalizeFnArgs<
Value extends LocaleUnitValue,
ArgCallback extends LocalizeFnArgCallback<Value> | undefined,
> = {
values: LocalizePeriodValuesMap<Value>;
defaultWidth: LocaleWidth;
formattingValues?: LocalizePeriodValuesMap<Value>;
defaultFormattingWidth?: LocaleWidth;
} & (ArgCallback extends undefined
? {
argumentCallback?: undefined;
}
: {
argumentCallback: LocalizeFnArgCallback<Value>;
});
/**
* The localize function argument callback which allows to convert raw value to
* the actual type.
*
* @param value - The value to convert
*
* @returns The converted value
*/
export type LocalizeFnArgCallback<Value extends LocaleUnitValue | number> = (
value: Value,
) => LocalizeUnitIndex<Value>;
/**
* The map of localized values for each width.
*/
export type LocalizePeriodValuesMap<Value extends LocaleUnitValue> = {
[Pattern in LocaleWidth]?: LocalizeValues<Value>;
};
/**
* The index type of the locale unit value. It types conversion of units of
* values that don't start at 0 (i.e. quarters).
*/
export type LocalizeUnitIndex<Value extends LocaleUnitValue | number> =
Value extends LocaleUnitValue ? keyof LocalizeValues<Value> : number;
/**
* Converts the unit value to the tuple of values.
*/
export type LocalizeValues<Value extends LocaleUnitValue> =
Value extends LocaleDayPeriod
? Record<LocaleDayPeriod, string>
: Value extends Era
? LocalizeEraValues
: Value extends Quarter
? LocalizeQuarterValues
: Value extends Day
? LocalizeDayValues
: Value extends Month
? LocalizeMonthValues
: never;
/**
* The tuple of localized era values. The first element represents BC,
* the second element represents AD.
*/
export type LocalizeEraValues = readonly [string, string];
/**
* The tuple of localized quarter values. The first element represents Q1.
*/
export type LocalizeQuarterValues = readonly [string, string, string, string];
/**
* The tuple of localized day values. The first element represents Sunday.
*/
export type LocalizeDayValues = readonly [
string,
string,
string,
string,
string,
string,
string,
];
/**
* The tuple of localized month values. The first element represents January.
*/
export type LocalizeMonthValues = readonly [
string,
string,
string,
string,
string,
string,
string,
string,
string,
string,
string,
string,
];
export declare function buildLocalizeFn<
Value extends LocaleUnitValue,
ArgCallback extends LocalizeFnArgCallback<Value> | undefined,
>(args: BuildLocalizeFnArgs<Value, ArgCallback>): LocalizeFn<Value>;