fix(web): resolve all 22 TypeScript typecheck errors in apps/web (TEC-3208)

- Fix TS4111: use bracket notation for index signature access in metadata.spec.ts,
  neighborhood-poi-map.tsx, and neighborhood-poi-map.spec.tsx
- Fix TS2740: add missing property fields (usableAreaM2, floor, totalFloors,
  nearbyPOIs, etc.) to test mock objects in 5 spec files
- Fix TS2339: add missing estimate() and create() methods to transferApi
- Fix TS4114: add override modifier to render() in page.tsx error boundary
- Fix TS2532: add optional chaining for possibly undefined features in
  neighborhood-poi-map.tsx

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-22 15:49:38 +07:00
parent 566ad75c0e
commit 1668c800fe
10 changed files with 97 additions and 14 deletions

View File

@@ -119,17 +119,17 @@ describe('listing page generateMetadata', () => {
expect(meta.alternates?.languages?.en).toMatch(/\/en\/listings\/listing-1$/);
const og = meta.openGraph as Record<string, unknown>;
expect(og.type).toBe('article');
expect(og.locale).toBe('vi_VN');
expect(og.siteName).toBe('GoodGo');
const ogImages = og.images as Array<{ url: string; width: number; height: number }>;
expect(og['type']).toBe('article');
expect(og['locale']).toBe('vi_VN');
expect(og['siteName']).toBe('GoodGo');
const ogImages = og['images'] as Array<{ url: string; width: number; height: number }>;
expect(ogImages[0]?.url).toBe('https://cdn.example.com/img1.jpg');
expect(ogImages[0]?.width).toBe(1200);
expect(ogImages[0]?.height).toBe(630);
const twitter = meta.twitter as Record<string, unknown>;
expect(twitter.card).toBe('summary_large_image');
expect((twitter.images as string[])[0]).toBe('https://cdn.example.com/img1.jpg');
expect(twitter['card']).toBe('summary_large_image');
expect((twitter['images'] as string[])[0]).toBe('https://cdn.example.com/img1.jpg');
expect(meta.other?.['og:price:currency']).toBe('VND');
expect(meta.other?.['og:price:amount']).toBe('3500000000');
@@ -146,8 +146,8 @@ describe('listing page generateMetadata', () => {
});
const og = meta.openGraph as Record<string, unknown>;
expect(og.locale).toBe('en_US');
const ogImages = og.images as Array<{ url: string }>;
expect(og['locale']).toBe('en_US');
const ogImages = og['images'] as Array<{ url: string }>;
expect(ogImages[0]?.url).toBe('/og-image.png');
});
});

View File

@@ -71,7 +71,7 @@ class SectionErrorBoundary extends React.Component<
return { hasError: true };
}
render() {
override render() {
if (this.state.hasError) {
return (
<div className="flex items-center gap-2 rounded-md border border-border bg-background-surface p-4 text-sm text-foreground-muted">