Zeke
Zeke
Explore posts from servers
PPrisma
Created by Zeke on 3/21/2024 in #help-and-questions
Pull Operator not Existing?
await db.$transaction([
db.account.update({
where: {
id: values[0],
isPrimary: false
},
data: {
guildIds: {
push: guild_id
}
}
}),
db.account.updateMany({
where: {
NOT: {
id: values[0]
},
guildIds: {
has: guild_id
}
},
data: {
guildIds: {
pull: guild_id
}
}
})
])
await db.$transaction([
db.account.update({
where: {
id: values[0],
isPrimary: false
},
data: {
guildIds: {
push: guild_id
}
}
}),
db.account.updateMany({
where: {
NOT: {
id: values[0]
},
guildIds: {
has: guild_id
}
},
data: {
guildIds: {
pull: guild_id
}
}
})
])
Hi. For some reason, in the data of my updateMany, pull is getting this type error:
Object literal may only specify known properties, and 'pull' does not exist in type 'string[] | AccountUpdateguildIdsInput | { set?: Exact<string[] | undefined, string[] | undefined>; push?: Exact<string | string[] | undefined, string | string[] | undefined>; }'.ts(2353)
index.d.ts(4604, 5): The expected type comes from property 'guildIds' which is declared here on type 'Exact<(Without<AccountUpdateManyMutationInput, AccountUncheckedUpdateManyInput> & AccountUncheckedUpdateManyInput) | (Without<...> & AccountUpdateManyMutationInput), (Without<...> & AccountUncheckedUpdateManyInput) | (Without<...> & AccountUpdateManyMutationInput)>'
Object literal may only specify known properties, and 'pull' does not exist in type 'string[] | AccountUpdateguildIdsInput | { set?: Exact<string[] | undefined, string[] | undefined>; push?: Exact<string | string[] | undefined, string | string[] | undefined>; }'.ts(2353)
index.d.ts(4604, 5): The expected type comes from property 'guildIds' which is declared here on type 'Exact<(Without<AccountUpdateManyMutationInput, AccountUncheckedUpdateManyInput> & AccountUncheckedUpdateManyInput) | (Without<...> & AccountUpdateManyMutationInput), (Without<...> & AccountUncheckedUpdateManyInput) | (Without<...> & AccountUpdateManyMutationInput)>'
Which is weird because pull is a documented update operator under MongoDB here: https://www.prisma.io/dataguide/mongodb/managing-documents Also, my schema states guildIds as string[]. So indeed it is an array, and indeed guild_id is a string. Thanks!
8 replies
DIAdiscord.js - Imagine an app
Created by Zeke on 3/8/2024 in #djs-questions
Property 'id' does not exist on type 'APIGuild'.
via Discord-Api-Types package, latest, I am receiving the type error: Type error: Property 'id' does not exist on type 'APIGuild'. But according to documentation, this should not be the case. I have no idea how to fix this, I have tried; restarting typescript server, restarting PC, reinstalling packages, and a myriad of other common fixes. What on earth is happening?
14 replies