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

fix onConflict compilation errors since TS 5.1.6. #568

Merged

Conversation

igalklebanov
Copy link
Member

@igalklebanov igalklebanov commented Jul 7, 2023

closes #567.

Seems like a bug in both TypeScript (up to 5.1.3) and in our codebase. We provided an expected return type that can never be matched by call site, and TypeScript never yelled.

And looks like they fixed it in 5.1.6?? 🤷

.doUpdateSet return type:

OnConflictUpdateBuilder<OnConflictDatabase<DB, TB>, OnConflictTables<TB>>

vs.

.onConflict's callback argument's return type:

OnConflictDoNothingBuilder<DB, TB> | OnConflictUpdateBuilder<DB, TB>

@igalklebanov igalklebanov added bug Something isn't working typescript Related to Typescript labels Jul 7, 2023
@vercel
Copy link

vercel bot commented Jul 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
kysely ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2023 9:53am

@igalklebanov
Copy link
Member Author

I think I wrongfully removed unused generics from do nothing builder. Will add them back once power outtage is over.

@koskimas koskimas merged commit 454695c into kysely-org:master Jul 7, 2023
5 checks passed
@igalklebanov igalklebanov deleted the fix-onconflict-compilation-error branch July 7, 2023 12:45
Gaspero pushed a commit to Gaspero/kysely that referenced this pull request Oct 2, 2023
* fix compilation errors since 5.1.6.

* rollback OnConflictDoNothing generics removal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working typescript Related to Typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compilation errors after upgrading to TypeScript 5.1.6 or newer.
2 participants