-
-
Notifications
You must be signed in to change notification settings - Fork 656
Open
Labels
Description
The type of execute's values parameter is any (so basically no type definition). Admittedly I'm not 100% sure I've found all the possibilities for what values can be, but I do know if you pass in an undefined value (for example connection.execute("SELECT 1 + ? + ?", [1, 2, undefined, 4]); it will throw an error.
I've noticed LLMs are pretty good at adhering to type definitions, but love to take advantage of the any here. Almost got us into trouble at work. How do we feel about using something like the following definition, which is as close a definition I can think of for "any, except undefined or an array with undefined".
type Value =
| string // <-- primitive
| number // <-- primitive
| boolean // <-- primitive
| symbol // <-- primitive
| bigint // <-- primitive
| null // <-- primitive
| Record<string, unknown> // <-- Object
| ({} | null)[]; // <-- (any - undefined) arrayI'll create a PR if this (or something else) looks good.
wellwelwel