-
Notifications
You must be signed in to change notification settings - Fork 311
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
base: master
Are you sure you want to change the base?
Fix #1440 #1443
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
commit: |
@@ -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' |
There was a problem hiding this comment.
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 🤷
There was a problem hiding this comment.
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.
There was a problem hiding this 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.)
I'll rebaseline the type benchmark if this should be merged.