© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
DT
Drizzle Team
•
3y ago
•
28 replies
mr_pablo
Error when inferring type from db.query
When I try to use
type foo = ReturnType<typeof myQuery>
type foo = ReturnType<typeof myQuery>
I get the following error
Type
'MySql2PreparedQuery
<PreparedQueryConfig
&
{ execute
:
{
[x
: string
]
: any
; matchPlayers
:
{
[x
: string
]
: any
; playerName
:
{
[x
: string
]
: any
;
}
|
{
[x
: string
]
: any
;
}
[
]
;
}
|
{
[x
: string
]
: any
; playerName
:
{
.
.
.
;
}
|
{
.
.
.
;
}
[
]
;
}
[
]
; matchTeams
:
{
.
.
.
;
}
|
{
.
.
.
;
}
[
]
; homeTeam
:
{
.
.
.
;
}
|
{
.
.
.
;
}
[
]
; awayTeam
:
{
.
.
.
;
.
.
.
' does not satisfy the constraint
'
(
.
.
.args
: any
)
=
> any
'
.
Type
'MySql2PreparedQuery
<PreparedQueryConfig
&
{ execute
:
{
[x
: string
]
: any
; matchPlayers
:
{
[x
: string
]
: any
; playerName
:
{
[x
: string
]
: any
;
}
|
{
[x
: string
]
: any
;
}
[
]
;
}
|
{
[x
: string
]
: any
; playerName
:
{
.
.
.
;
}
|
{
.
.
.
;
}
[
]
;
}
[
]
; matchTeams
:
{
.
.
.
;
}
|
{
.
.
.
;
}
[
]
; homeTeam
:
{
.
.
.
;
}
|
{
.
.
.
;
}
[
]
; awayTeam
:
{
.
.
.
;
.
.
.
' provides no match for the signature
'
(
.
.
.args
: any
)
: any
'
The query is a prepared statement outside of my class
, and I have the type just underneath so it can be used globally by functions inside my class
.
Drizzle Team
Join
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
Properly inferring Prepared Statement Return Type when executing a query
DT
Drizzle Team / help
2y ago
DB type error
DT
Drizzle Team / help
3y ago
json column type mismatch when using db.query
DT
Drizzle Team / help
3y ago
drizzle-orm not inferring type from soft relations
DT
Drizzle Team / help
15mo ago