Incorrect InputJsonValue type
See original GitHub issueBug description
Hello!
Right now JsonValue
is not assignable to InputJsonValue
and I think it is incorrect because I believe InputJsonValue
is supposed to be a wider type.
Probably
export type InputJsonValue = string | number | boolean | InputJsonObject | InputJsonArray
// should be
export type InputJsonValue = string | number | boolean | InputJsonObject | InputJsonArray | null
How to reproduce
Get any model that has a JSON field and try to use this field in for example in update
and see
Type 'JsonValue' is not assignable to type 'InputJsonValue'.
Type 'null' is not assignable to type 'InputJsonValue'.
Expected behavior
JsonValue
being assignable to InputJsonValue
Prisma information
model AnyModel {
...
jsonField Json
...
}
const rec = prisma.anyModel.findUnique({});
prisma.anyModel.update({ data: { jsonField: rec.jsonField } });
Environment & setup
Typescritp: 4.4.3 { "strict": true }
Prisma Version
prisma : 3.0.2
@prisma/client : 3.0.2
Current platform : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine : migration-engine-cli 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary : prisma-fmt 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash : 2452cc6313d52b8b9a96999ac0e974d0aedf88db
Studio : 0.423.0
Preview Features : orderByRelation
Issue Analytics
- State:
- Created 2 years ago
- Reactions:21
- Comments:14 (5 by maintainers)
Top Results From Across the Web
Allow interface to implicitly convert to JsonData - Stack Overflow
But I get the error Type 'AttachedFile' is not assignable to type '{ [property: string]: JsonValue; }'. Index signature is missing in type...
Read more >JSON field type invalid input - Questions - Prisma 1 Forum
Old answer: Is that in the Playground or a specific GraphQL Client? Here's an example with Lokka. In the Playground, this should work:...
Read more >prisma is not assignable to type - You.com | The AI Search ...
I'm having an issue with this strange typescript error stating that type number is not assignable to ... prisma/prismaIncorrect InputJsonValue type#9247.
Read more >Request model null in .NET core API if input json value integer
However, passing a telephone "number" as a number is a mistake. Despite the name, it's not a "number" in that sense.
Read more >type-graphql/prisma2 - Gitter
Hi, I'm try use typegraphql-prisma and the generated label(Label.ts) has a bad path to the prisma client import { JsonValue, InputJsonValue } from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
work around using spread:
This is quite annoying… if I don’t do this I get ->
Full code for context:
and then in
user.model.ts
Just want to confirm this bug still exists in
3.7.0
and I just stumbled upon it today.