drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

[SQLite] Fix type of get() method for sqlite-based dialects

Open stefanmaric opened this issue 2 years ago • 1 comments

Following up https://github.com/drizzle-team/drizzle-orm/pull/459

The types of .get() on .select() statements don't include undefined:

const user = db.select().from(users).where(eq(users.id, 'madeup').get() // ^? const user: { ... }

But at runtime it can return undefined.

--

Now, this is overriding the type for .insert(), .update(), and .delete() methods and cannot tell if this is accurate or not.

Thoughts?

stefanmaric avatar May 18 '23 17:05 stefanmaric

Makes sense. If you could add some integration and type tests that confirm this behavior, I'd be glad to merge this.

dankochetov avatar May 28 '23 17:05 dankochetov

Is this good to go? Also hit the same thing today with d1 :)

tjenkinson avatar Jun 11 '23 20:06 tjenkinson

Thank you!

gmaclennan avatar Aug 09 '23 13:08 gmaclennan