Skip to content

fix(kysely-driver): export the database, dialect and driver classes - #1202

Open
shahjahanpak wants to merge 1 commit into
powersync-ja:mainfrom
shahjahanpak:fix/1194-kysely-exports
Open

shahjahanpak wants to merge 1 commit into
powersync-ja:mainfrom
shahjahanpak:fix/1194-kysely-exports

Conversation

@shahjahanpak

Copy link
Copy Markdown

Fixes #1194

packages/kysely-driver/src/index.ts imported PowerSyncKyselyDatabase with type, then listed it in the export { … } block. So the package exported it as a type only. At runtime it is undefined: class AppDatabase extends PowerSyncKyselyDatabase throws Class extends value undefined is not a constructor or null. PowerSyncDialect and PowerSyncDriver were not exported at all, so an app could not build its own Kysely instance on the PowerSync dialect, for example to add plugins.

The index now imports PowerSyncKyselyDatabase as a value, and also exports PowerSyncDialect and PowerSyncDriver with their option types PowerSyncKyselyOptions and PowerSyncDialectConfig. Nothing else changes. I did not export PowerSyncConnection, because the driver creates it and the issue did not ask for it. Happy to add it if you want the full set.

This adds public API, so I understand if you would rather keep some of it internal.

Tests. A new tests/exports.test.ts imports from src/index.ts, the package entry point:

  • The three classes are functions at runtime. On main: expected undefined to be type of 'function'.
  • An app class that extends PowerSyncKyselyDatabase inserts and counts rows. On main: Class extends value undefined is not a constructor or null.
  • A plain new Kysely({ dialect: new PowerSyncDialect({ db }) }) inserts and selects rows. On main: SUT.PowerSyncDialect is not a constructor.

All 31 tests in the package pass in Chromium, attw (test:exports) is green, and the changed files are formatted with the repo's prettier settings. There's a patch changeset for @powersync/kysely-driver.

🤖 Generated with Claude Code

PowerSyncKyselyDatabase was re-exported from a type-only import, so it
was undefined at runtime and could not be extended or constructed.
PowerSyncDialect and PowerSyncDriver were not exported at all. Export
all three as values, with their option types.

Fixes powersync-ja#1194

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@changeset-bot

changeset-bot Bot commented Nov 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: aa58805

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@powersync/kysely-driver Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
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.

Please export PowerSyncKyselyDatabase, PowerSyncDialect, PowerSyncDriver

1 participant