Skip to content

fix(kysely-tailordb): stop depending on the global Tailordb namespace - #224

Merged
toiroakr merged 2 commits into
mainfrom
fix/kysely-tailordb-client-type
Nov 12, 2026
Merged

toiroakr merged 2 commits into
mainfrom
fix/kysely-tailordb-client-type

Conversation

@toiroakr

@toiroakr toiroakr commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The published dist/index.d.ts had constructor(client: Tailordb.Client). Tailordb is a global type namespace that only @tailor-platform/function-types declares, and that package is deprecated (docs(types): deprecate function-types in favor of @tailor-platform/sdk #190). Without it, a project that type-checks library declarations (skipLibCheck: false) gets TS2833: Cannot find namespace 'Tailordb', or TS2503 when no ambient types are loaded at all. TypeScript 5.9.3, 6.0.3 and 7.1 report the same error.
  • TailordbDialect now takes a TailordbClient that the package defines itself: just the three methods the dialect calls (connect, end, queryObject). Both the legacy Tailordb.Client and the tailordb.Client of @tailor-platform/sdk are assignable to it. The change is types only; runtime behavior is the same.
  • The package no longer needs function-types for its own type check, so tsconfig.json and devDependencies drop it. The README now points at the runtime globals of @tailor-platform/sdk. kysely-tailordb-codegen is not touched and still depends on function-types.
  • A type-only test (type-tests/client-compat.ts) passes both clients to TailordbDialect, and type-check runs it. @tailor-platform/sdk and function-types are devDependencies for that, so a Renovate bump of either package that changes the client shape fails CI.

Why not rename Tailordb.Client to the lowercase tailordb.Client instead: that is what @tailor-platform/sdk declares, but projects that still use only function-types (which declares the type namespace as Tailordb and tailordb only as a value) would newly get TS2833.

Type-checking dist/index.d.ts with skipLibCheck: false (TypeScript 5.9.3, @tailor-platform/sdk 2.40.0, @tailor-platform/function-types 0.10.2):

Ambient types available Before After
function-types only no error no error
@tailor-platform/sdk runtime globals only TS2833 no error
neither TS2503 no error

@toiroakr toiroakr changed the title fix(kysely-tailordb): stop depending on the global Tailordb namespace fix(kysely-tailordb): stop depending on the global Tailordb namespace and update dependencies Nov 11, 2026
The published declarations referenced `Tailordb.Client`, a global type
namespace that only the deprecated @tailor-platform/function-types
declares. Without that package, consumers that do not skip library
checks got TS2833 (or TS2503 when no ambient types were loaded at all).

Describe the client by the three methods the dialect calls instead.
Both the legacy `Tailordb.Client` and the `tailordb.Client` of
@tailor-platform/sdk are assignable to it, and runtime behavior is
unchanged. The package no longer needs function-types for its own type
check, so drop it from tsconfig and devDependencies, and point the
README at the SDK runtime globals.
…are accepted

Add a type-only test that passes both the legacy `Tailordb.Client` of
@tailor-platform/function-types and the `tailordb.Client` of
@tailor-platform/sdk to TailordbDialect. If either package changes the
shape of its client in a way the dialect cannot accept, type-check now
fails, including when Renovate bumps the SDK.

The test needs the SDK exports map to resolve, so it has its own
tsconfig with bundler module resolution and type-check runs both.
@toiroakr
toiroakr force-pushed the fix/kysely-tailordb-client-type branch from 9da33a9 to a7c49a9 Compare November 11, 2026 08:01
@toiroakr toiroakr changed the title fix(kysely-tailordb): stop depending on the global Tailordb namespace and update dependencies fix(kysely-tailordb): stop depending on the global Tailordb namespace Nov 11, 2026
@toiroakr
toiroakr marked this pull request as ready for review November 11, 2026 12:39
@toiroakr
toiroakr requested a review from a team as a code owner November 11, 2026 12:39
@toiroakr
toiroakr enabled auto-merge (squash) November 11, 2026 12:40

@jackchuka jackchuka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@toiroakr
toiroakr merged commit 0483ef9 into main Nov 12, 2026
6 checks passed
@toiroakr
toiroakr deleted the fix/kysely-tailordb-client-type branch November 12, 2026 00:43
@github-actions github-actions Bot mentioned this pull request Nov 12, 2026
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.

2 participants