Replace hand-written TMDB types with openapi-fetch + generated schema

- Add `openapi-fetch` dependency; generate `lib/tmdb/schema.d.ts` from
  TMDB's OpenAPI spec and delete `lib/tmdb/types.ts`
- Rewrite `lib/tmdb/client.ts` to use the typed fetch client against
  the generated schema, exporting `TmdbMovieDetails`, `TmdbTvDetails`,
  `TmdbVideo`, and `TmdbGenre` directly
- Fix null-safety across services (`credits`, `availability`,
  `metadata`, `person`, `webhooks`) and call sites (explore page,
  search route, explore actions) to handle optional fields produced
  by the stricter generated types
- Update `metadata.ts` and `metadata.test.ts` to import shared types
  from `@/lib/tmdb/client` instead of the removed `types.ts`
- Exclude `lib/tmdb/schema.d.ts` from Biome linting
This commit is contained in:
jake committed 2026-03-08 14:07:32 -04:00
1 parent ad8ec62317
commit 0838e5fb74
15 files changed
+23373 -491

No files matched your search

+3 -1
View File
@@ -15,7 +15,8 @@
"db:migrate": "bun --bun drizzle-kit migrate",
"db:push": "bun --bun drizzle-kit push",
"db:studio": "bun --bun drizzle-kit studio",
"db:seed": "bun run scripts/seed.ts"
"db:seed": "bun run scripts/seed.ts",
"generate-tmdb-schema": "bunx openapi-typescript https://developer.themoviedb.org/openapi/tmdb-api.json -o ./lib/tmdb/schema.d.ts"
},
"dependencies": {
"@base-ui/react": "1.2.0",
@@ -35,6 +36,7 @@
"motion": "12.35.1",
"next": "16.1.6",
"node-vibrant": "4.0.4",
"openapi-fetch": "0.17.0",
"react": "19.2.4",
"react-day-picker": "9.14.0",
"react-dom": "19.2.4",