Skip to content

Fix #1440 #1443

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

koskimas
Copy link
Member

@koskimas koskimas commented Apr 24, 2025

I'll rebaseline the type benchmark if this should be merged.

@koskimas koskimas requested a review from igalklebanov April 24, 2025 17:55
Copy link

vercel bot commented Apr 24, 2025

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 Apr 27, 2025 2:33pm

Copy link

pkg-pr-new bot commented Apr 24, 2025

kysely_koa_example

npm i https://pkg.pr.new/kysely-org/kysely@1443

commit: 2f758da

@@ -36,6 +36,19 @@ async function testKyselyAnySelects(db: Kysely<any>) {
])
.executeTakeFirstOrThrow()
expectType<{ bar: any; spam: any; baz: 1 }>(r6)

const table: 'foo' | 'bar' = Math.random() > 0.5 ? 'foo' : 'bar'
Copy link
Member Author

@koskimas koskimas Apr 24, 2025

Choose a reason for hiding this comment

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

This Math.random() tomfoolery is needed because typescript is too smart. Otherwise it'll use the narrowed type based on the value expression and disregard the explicit type 🤷

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, obviously it doesn't need to be Math.random() but something that can't be inferred at compile time.

@igalklebanov igalklebanov added bug Something isn't working typescript Related to Typescript labels Apr 27, 2025
Copy link
Member

@igalklebanov igalklebanov left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

(what about insertInto types? I'm seeing just deleteFrom, mergeInto, selectFrom and updateTable in the changes.)

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.

2 participants