fix: 修复 Restaurant 类型转换的 TypeScript 编译错误
This commit is contained in:
@@ -27,7 +27,7 @@ import type { UserProfile, UserPreferences, DecisionRecord, FavoriteRecord, Rest
|
|||||||
function firstImage(r: Restaurant): string {
|
function firstImage(r: Restaurant): string {
|
||||||
if (r.images?.length > 0) return r.images[0];
|
if (r.images?.length > 0) return r.images[0];
|
||||||
// backward compat: old DB records may have `image` instead of `images`
|
// backward compat: old DB records may have `image` instead of `images`
|
||||||
const legacy = (r as Record<string, unknown>).image;
|
const legacy = (r as unknown as Record<string, unknown>).image;
|
||||||
return typeof legacy === "string" ? legacy : "";
|
return typeof legacy === "string" ? legacy : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user