drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
23.03k stars 556 forks source link

[BUG]: #2631

Open seanyasno opened 1 month ago

seanyasno commented 1 month ago

What version of drizzle-orm are you using?

0.31.1

What version of drizzle-kit are you using?

0.20.14

Describe the Bug

when using inArray function it can accept empty array as value and it compile just fine but it fails in the run time if there is an empty array.

Expected behavior

The expected behavior is to accept non-empty-array type so that it will fail on compile time if an array could be empty. Here's an example of what I'm talking about:

function inArray<Value>(key: string, array: [Value, ...Value[]]) {
  // ... Some Code implementation ...
}

Environment & setup

No response

RemiPeruto commented 1 month ago

@seanyasno you should update to the version 0.32.1 of drizzle-orm see https://github.com/drizzle-team/drizzle-orm/pull/2502 The behaviour to throw has been removed in this version