mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-16 20:40:45 +00:00
19 lines
584 B
TypeScript
19 lines
584 B
TypeScript
export function readStatusIssueFields<TField extends string>(
|
|
value: unknown,
|
|
fields: readonly TField[],
|
|
): Record<TField, unknown> | null {
|
|
if (!value || typeof value !== "object") {
|
|
return null;
|
|
}
|
|
const record = value as Record<string, unknown>;
|
|
const result = {} as Record<TField, unknown>;
|
|
for (const field of fields) {
|
|
result[field] = record[field];
|
|
}
|
|
return result;
|
|
}
|
|
|
|
export function coerceStatusIssueAccountId(value: unknown): string | undefined {
|
|
return typeof value === "string" ? value : typeof value === "number" ? String(value) : undefined;
|
|
}
|