Kuhave
Kuhave
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
lol
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
but type problem is happened when ur using Json field lol
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
if ur not using Json field, u can input as-is
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
u need to convert return type to create type to match null value
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
as i said
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
use this code
const user = await prisma.user.create({
data: {
...data,
attribute: data.attribute === null ? Prisma.JsonNull : data.attribute,
},
});
const user = await prisma.user.create({
data: {
...data,
attribute: data.attribute === null ? Prisma.JsonNull : data.attribute,
},
});
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
but current Prisma does not..lol
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
yes i agree that in your case(not allow DB null, but can be JSON null), prisma should accept null value as JSON null smoothly
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
JsonValue is 'return type', not 'create type' (of User.attribute).
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
otherwise, just insert as-is.
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
so, if u intend to create user with attribute 'JSON null', you should convert typescript null value to Prisma.JsonNull.
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
yes
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
which means 'should not be typescript null'
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
on create, you need to set 'attribute' field to appropriate 'create type of User.attribute'
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
right?
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
you are trying to 'create user'
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
especially if there is a Json type lol
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
in Prisma, it would be good to understand that the type used when creating and the result type of the query may be different.
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
hmm...
166 replies
PPrisma
Created by kartîk on 7/23/2024 in #help-and-questions
Ts Error for Prisma Json field with null value
No description
166 replies