feat(types): adopt TypeScript types generated from the API - #1243
Draft
escapedcat wants to merge 7 commits into
Draft
feat(types): adopt TypeScript types generated from the API#1243escapedcat wants to merge 7 commits into
escapedcat wants to merge 7 commits into
Conversation
…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>
✅ Deploy Preview for btcmap ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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:apifetches that path from master.What this does
pnpm types:apito refresh the types: it fetches (degit) the committedbindings/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 changesrc/types/btcmap-api/— byte-identical output of btcmap-api'sdevtools export-ts-types(ts-rs), never hand-edited. biome excludes the directory soformat:fixcan't drift it from the generator's output$typesalias (src/types) so imports read$types/btcmap-api/SearchResponseinstead of deep relative pathsPlacetypes exist:$lib/typesPlacestays the app-facing type; the generatedPlaceis the API contract shape for thefields-driven endpointssrc/routes/api/search/places/+server.ts) types its upstream response asPartial<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/typesAPI entries becoming aliases of the generated schemas — tracked in teambtcmap/btcmap-api#102.Test plan
pnpm typecheck,pnpm lint— cleanpnpm vitest run src/routes/api/search/places/server.test.ts— 7/7, including the malformed-upstream tolerance test🤖 Generated with Claude Code