Skip to content

refactor(cf): adopt @cloudflare/workers-types#61

Open
techiejd wants to merge 4 commits into
mainfrom
feat/cf-workers-types
Open

refactor(cf): adopt @cloudflare/workers-types#61
techiejd wants to merge 4 commits into
mainfrom
feat/cf-workers-types

Conversation

@techiejd
Copy link
Copy Markdown
Owner

@techiejd techiejd commented Jun 1, 2026

Swaps the hand-rolled Vectorize binding types for the official @cloudflare/workers-types package.

  • Adds @cloudflare/workers-types as a devDependency.
  • Deletes hand-rolled VectorizeMatch, VectorizeQueryResult, VectorizeVector, and the CloudflareVectorizeBinding interface; getVectorizeBinding now returns the official global Vectorize type (which exposes getByIds).
  • Keeps a back-compat alias export type CloudflareVectorizeBinding = Vectorize so the published export name is unchanged.
  • Pulls the ambient globals via a triple-slash reference in types.ts (no compilerOptions.types narrowing — tsconfig.build.json stays in parity with the pg/mongodb adapters).

No behavior change. Full CF suite green (90 tests) with zero test edits.

Prerequisite for findEmbeddingsByIds — unlocks the typed getByIds used by the upcoming CF findByIds.

techiejd added 2 commits June 1, 2026 17:22
The CF adapter's '/// <reference types="@cloudflare/workers-types" />'
pulls in Workers ambient globals that redefine Request/Response (where
.json() returns unknown, not the DOM's any). The root tsconfig included
./adapters/*/src/**, so 'tsc --noEmit' (build:types:all) leaked those
globals into core endpoint/admin code and failed typecheck. Adapters are
already typechecked independently via their own tsconfig.build.json in the
CI build job, so root coverage of adapter sources was redundant.
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