Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expo-sqlite type issue #248

Closed
isaporiti opened this issue Jul 13, 2023 · 2 comments
Closed

expo-sqlite type issue #248

isaporiti opened this issue Jul 13, 2023 · 2 comments

Comments

@isaporiti
Copy link

When running the typecheck node task, I get the following error:

test/example-typing-usage/expo-sqlite.ts:14:32 - error TS2345: Argument of type 'SQLiteDatabase' is not assignable to parameter of type 'Database'.
  Type 'SQLiteDatabase' is not assignable to type 'WebSQLDatabase & { _name?: string | undefined; }'.
    Type 'SQLiteDatabase' is missing the following properties from type 'WebSQLDatabase': version, transaction, readTransaction

This happens in the expo-sqlite example because electrify expects an implementation of either Database or WebSQLDatabase interfaces from expo-sqlite.

Even if expo-sqlite does declare and export a Database interface, their openDatabase function returns an instance of SQLiteDatabase, which doesn't implement it.

I see that this electrify is tested with a mock implementation of Database. Did you have this type mismatch in mind when running this specific case?

@icehaunter
Copy link
Contributor

Hello @isaporiti! Thanks for the report. We'll look into this, likely early next week. It's a little weird you're getting this error on our codebase, given that the typecheck task is ran on main and on every PR and is green: https://github.com/electric-sql/electric/actions/runs/5541123991/jobs/10114120291

Did you install deps as in pnpm install --frozen-lockfile? Maybe something got updated (again 🙃) and broke the types?

@isaporiti
Copy link
Author

Hi @icehaunter ! Thank you for the prompt response. I actually had installed dependencies with npm, and it seems I had another version of expo-sqlite with it. Installing dependencies again with pnpm as you indicate solved it.
Thank you again!

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

No branches or pull requests

2 participants