Search
Star
Feedback
Setup for Free
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Dealing with type safety - Drizzle Team
DT
Drizzle Team
•
3y ago
•
2 replies
diegofariasm
Dealing with type safety
I am trying to do something like this
:
if
(result
.length
=
=
= 0
)
{
throw new Error
(
No user with id ${id} found.
No user with id ${id} found.
)
;
}
return result
[0
]
;
But typescript complains that
{
.
.
.
.
}
| undefined is assignable to
{
.
.
.
}
. How could i fix that
? Should the if already deal with the case in which result is undefined
?
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
Similar Threads
Type safety on .set() method?
DT
Drizzle Team / help
2y ago
Dealing with Supabase Auth
DT
Drizzle Team / help
2y ago
Turborepo - no type safety when using drizzle in other modules
DT
Drizzle Team / help
7mo ago
Prepare statement throws type error for enums. How to get type safety for prepared values
DT
Drizzle Team / help
3y ago