Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dwickern
Copy link
Contributor

@dwickern dwickern commented Mar 29, 2021

The multi-column variants (any, many, maybeOne, one, query) always return a hash.
The single-column variants (anyFirst, manyFirst, maybeOneFirst, oneFirst) always return a single column type.

This PR makes it harder to use the wrong one.

// correct
connection.any<{ col1: number, col2: string}>(sql`...`)
connection.anyFirst<number>(sql`...`)

// incorrect
connection.any<string>(sql`...`)
connection.anyFirst<{ foo: number }>(sql`...`)

This change caught one such bug in the test suite.

@dwickern dwickern force-pushed the improve-query-types branch from 0739264 to 62f96a5 Compare March 29, 2021 17:26
@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.185% when pulling 62f96a5 on dwickern:improve-query-types into 9cd5499 on gajus:master.

@gajus gajus merged commit 52255ae into gajus:master Mar 30, 2021
@gajus
Copy link
Owner

gajus commented Mar 30, 2021

🎉 This PR is included in version 23.6.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

3 participants