typescript-typenfehler behoben.. npm run lint läuft nun fehlerfrei durch.

This commit is contained in:
Codex Agent
2025-11-22 11:49:47 +01:00
parent 6c78d7e281
commit eb41cb6194
74 changed files with 469 additions and 396 deletions

View File

@@ -5,17 +5,19 @@ function extractErrorMessage(payload: unknown): string {
return 'coupon_error_generic';
}
const data = payload as Record<string, any>;
const data = payload as Record<string, unknown>;
if (data.message && typeof data.message === 'string') {
if (typeof data.message === 'string') {
return data.message;
}
if (data.errors) {
const errors = data.errors as Record<string, string[]>;
if (data.errors && typeof data.errors === 'object') {
const errors = data.errors as Record<string, unknown>;
const firstKey = Object.keys(errors)[0];
if (firstKey && Array.isArray(errors[firstKey]) && errors[firstKey][0]) {
return errors[firstKey][0];
const firstEntry = firstKey ? errors[firstKey] : undefined;
if (Array.isArray(firstEntry) && typeof firstEntry[0] === 'string') {
return firstEntry[0];
}
}