-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing raw object to JSON field results in typescript error #587
Comments
I've had to revert to using the deprecated This query sql`SELECT * FROM json_to_recordset(${object}::json) ...` also gave me the error |
I can't comment on the
(I believe the This The only weirdness I've seen with this method (which is also an issue with |
Yes, typing the object as 'any' works. (That 'as'-construction only works in actual TypeScript files though, I use plain javascript wit JSDoc typings.) Without the Still feels a bit wrong, but I'll cary on with any. |
Interesting. I'm not sure what's different but that's not the behavior I'm seeing. I tried just now and when I do
I get an actual JSON object in the database. I can query it using the JSON operators like To get a string there, I have to stringify it myself; something like
For reference I'm using v3.3.4 of this library and Postgres 15.3 via docker. |
This seems related to #392 . Reopen if not. |
I have a table with a column of type 'JSON' (plain, not JSONB). I have a js object that I want to store in the database.
I am using the following (simplified) function:
This works, but vscode returns a typescript error that I can't make much of:
I've tried all kinds of things to get rid of it, but I don't see the error. I found a similar comment here: #556 and here #415, but these were closed with no mention of solution.
Any idea what I am doing wrong?
Thanks!
The text was updated successfully, but these errors were encountered: