Skip to content

feat(types): adopt TypeScript types generated from the API - #1243

Draft
escapedcat wants to merge 7 commits into
mainfrom
feat/api-types
Draft

feat(types): adopt TypeScript types generated from the API#1243
escapedcat wants to merge 7 commits into
mainfrom
feat/api-types

Conversation

@escapedcat

@escapedcat escapedcat commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Frontend half of teambtcmap/btcmap-api#102 — adopts the TypeScript types generated from the API's v4 response structs. Companion to teambtcmap/btcmap-api#103 (the generator, already merged) and teambtcmap/btcmap-api#104 (moves the bindings to bindings/ts/), which should land before this PR — pnpm types:api fetches that path from master.

What this does

  • Adds pnpm types:api to refresh the types: it fetches (degit) the committed bindings/ts/ directory from btcmap-api's master — no Rust toolchain or btcmap-api checkout needed; btcmap-api's CI guarantees that directory always matches its code. The resulting diff gets committed here and doubles as a readable record of the API change
  • Commits the 39 generated type files under src/types/btcmap-api/ — byte-identical output of btcmap-api's devtools export-ts-types (ts-rs), never hand-edited. biome excludes the directory so format:fix can't drift it from the generator's output
  • Adds a $types alias (src/types) so imports read $types/btcmap-api/SearchResponse instead of deep relative paths
  • Documents the setup in AGENTS.md, including the transitional state where two Place types exist: $lib/types Place stays the app-facing type; the generated Place is the API contract shape for the fields-driven endpoints
  • Migrates the first call site: the search proxy (src/routes/api/search/places/+server.ts) types its upstream response as Partial<SearchResponse> instead of an inline hand-written cast (Partial because the proxy deliberately tolerates an upstream omitting fields — covered by its existing tests)

Migration plan

Remaining call sites move to the generated types incrementally as areas of the app are touched, with $lib/types API entries becoming aliases of the generated schemas — tracked in teambtcmap/btcmap-api#102.

Test plan

  • pnpm typecheck, pnpm lint — clean
  • pnpm vitest run src/routes/api/search/places/server.test.ts — 7/7, including the malformed-upstream tolerance test

🤖 Generated with Claude Code

escapedcat and others added 3 commits August 12, 2026 15:18
…e structs

Generated by btcmap-api's `devtools export-ts-types` (ts-rs). Regenerate
by running that command from a btcmap-api checkout next to this repo.

Also excludes src/types/btcmap-api from biome: the directory must stay
byte-identical to the generator's output, and format:fix would otherwise
reformat it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Documents the two-Place-types situation while the incremental migration
from hand-written API types is in progress.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…onse

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@netlify

netlify Bot commented Aug 12, 2026

Copy link
Copy Markdown

Deploy Preview for btcmap ready!

Name Link
🔨 Latest commit 23a8b9a
🔍 Latest deploy log https://app.netlify.com/projects/btcmap/deploys/6a7d716486bb7900085fa896
😎 Deploy Preview https://deploy-preview-1243--btcmap.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 55 (🔴 down 31 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (🔴 down 8 from production)
SEO: 96 (no change from production)
PWA: 90 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e5987b3e-4055-46c9-a7be-9ee3432d4384

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
escapedcat and others added 3 commits August 12, 2026 15:38
pnpm types:api now degits btcmap-api's committed bindings/ directory,
which its CI keeps in sync with the code — no Rust toolchain needed here.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
btcmap-api is moving its bindings under a per-language subdirectory.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant