AmazingViegas
AmazingViegas
Explore posts from servers
PPrisma
Created by AmazingViegas on 1/15/2025 in #help-and-questions
Query works but getting a TS error
Sorry, this is the game schema:
model Game {
id Int @id @default(autoincrement())
title String @unique
identifier String @unique
description String?
createdAt DateTime @default(now())
maxPlayers Int?
minPlayers Int?
imageUrl String?
year Int?
chats Chat[]
plays Play[]
favorites FavoriteGame[]
}
model Game {
id Int @id @default(autoincrement())
title String @unique
identifier String @unique
description String?
createdAt DateTime @default(now())
maxPlayers Int?
minPlayers Int?
imageUrl String?
year Int?
chats Chat[]
plays Play[]
favorites FavoriteGame[]
}
8 replies
PPrisma
Created by AmazingViegas on 1/15/2025 in #help-and-questions
Query works but getting a TS error
Type '{ player: { connectOrCreate: { where: { OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }; create: { name: string | undefined; bggUsername: string | undefined; ownerId: string; }; }; }; team: string | undefined; score: number; winner: boolean; firstTime: boolean; }' is not assignable to type 'PlayPlayerCreateWithoutPlayInput'.
The types of 'player.connectOrCreate.where' are incompatible between these types.
Type '{ OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }' is not assignable to type 'PlayerWhereUniqueInput'.
Type '{ OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }' is not assignable to type '{ id: number | PlayerOwnerIdNameCompoundUniqueInput | PlayerOwnerIdBggIdCompoundUniqueInput | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdName: number | ... 2 more ... | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdBggId: number | ... 2 more ... | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdBg...'.
Type '{ OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }' is missing the following properties from type '{ id: number | PlayerOwnerIdNameCompoundUniqueInput | PlayerOwnerIdBggIdCompoundUniqueInput | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdName: number | ... 2 more ... | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdBggId: number | ... 2 more ... | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdBg...': id, OwnerIdName, OwnerIdBggId
Type '{ player: { connectOrCreate: { where: { OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }; create: { name: string | undefined; bggUsername: string | undefined; ownerId: string; }; }; }; team: string | undefined; score: number; winner: boolean; firstTime: boolean; }' is not assignable to type 'PlayPlayerCreateWithoutPlayInput'.
The types of 'player.connectOrCreate.where' are incompatible between these types.
Type '{ OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }' is not assignable to type 'PlayerWhereUniqueInput'.
Type '{ OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }' is not assignable to type '{ id: number | PlayerOwnerIdNameCompoundUniqueInput | PlayerOwnerIdBggIdCompoundUniqueInput | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdName: number | ... 2 more ... | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdBggId: number | ... 2 more ... | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdBg...'.
Type '{ OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }' is missing the following properties from type '{ id: number | PlayerOwnerIdNameCompoundUniqueInput | PlayerOwnerIdBggIdCompoundUniqueInput | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdName: number | ... 2 more ... | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdBggId: number | ... 2 more ... | PlayerOwnerIdBggUsernameCompoundUniqueInput; OwnerIdBg...': id, OwnerIdName, OwnerIdBggId
8 replies
PPrisma
Created by AmazingViegas on 1/15/2025 in #help-and-questions
Query works but getting a TS error
And this is the error message:
Type '{ player: { connectOrCreate: { where: { OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }; create: { name: string | undefined; bggUsername: string | undefined; ownerId: string; }; }; }; team: string | undefined; score: number; winner: boolean; firstTime: boolean; }[]' is not assignable to type '(Without<PlayPlayerCreateWithoutPlayInput, PlayPlayerUncheckedCreateWithoutPlayInput> & PlayPlayerUncheckedCreateWithoutPlayInput) | (Without<...> & PlayPlayerCreateWithoutPlayInput) | PlayPlayerCreateWithoutPlayInput[] | PlayPlayerUncheckedCreateWithoutPlayInput[] | undefined'.
Type '{ player: { connectOrCreate: { where: { OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }; create: { name: string | undefined; bggUsername: string | undefined; ownerId: string; }; }; }; team: string | undefined; score: number; winner: boolean; firstTime: boolean; }[]' is not assignable to type 'PlayPlayerCreateWithoutPlayInput[]'.
Type '{ player: { connectOrCreate: { where: { OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }; create: { name: string | undefined; bggUsername: string | undefined; ownerId: string; }; }; }; team: string | undefined; score: number; winner: boolean; firstTime: boolean; }[]' is not assignable to type '(Without<PlayPlayerCreateWithoutPlayInput, PlayPlayerUncheckedCreateWithoutPlayInput> & PlayPlayerUncheckedCreateWithoutPlayInput) | (Without<...> & PlayPlayerCreateWithoutPlayInput) | PlayPlayerCreateWithoutPlayInput[] | PlayPlayerUncheckedCreateWithoutPlayInput[] | undefined'.
Type '{ player: { connectOrCreate: { where: { OwnerIdBggUsername: { ownerId: string; bggUsername: string | undefined; }; }; create: { name: string | undefined; bggUsername: string | undefined; ownerId: string; }; }; }; team: string | undefined; score: number; winner: boolean; firstTime: boolean; }[]' is not assignable to type 'PlayPlayerCreateWithoutPlayInput[]'.
8 replies
PPrisma
Created by AmazingViegas on 1/15/2025 in #help-and-questions
Query works but getting a TS error
The schema related to this is:
model Play {
id Int @id @default(autoincrement())
gameId Int
duration Int?
location String?
userId String
date DateTime
notes String?
game Game @relation(fields: [gameId], references: [id])
players PlayPlayer[]
}

model PlayPlayer {
id Int @id @default(autoincrement())
play Play @relation(fields: [playId], references: [id])
playId Int
player Player @relation(fields: [playerId], references: [id])
playerId Int
team String?
score Int?
winner Boolean
firstTime Boolean
}

model Player {
id Int @id @default(autoincrement())
name String
bggUsername String?
bggId String?
playPlayers PlayPlayer[]
ownerId String

@@unique(name: "OwnerIdName", [ownerId, name])
@@unique(name: "OwnerIdBggId", [ownerId, bggId])
@@unique(name: "OwnerIdBggUsername", [ownerId, bggUsername])
model Play {
id Int @id @default(autoincrement())
gameId Int
duration Int?
location String?
userId String
date DateTime
notes String?
game Game @relation(fields: [gameId], references: [id])
players PlayPlayer[]
}

model PlayPlayer {
id Int @id @default(autoincrement())
play Play @relation(fields: [playId], references: [id])
playId Int
player Player @relation(fields: [playerId], references: [id])
playerId Int
team String?
score Int?
winner Boolean
firstTime Boolean
}

model Player {
id Int @id @default(autoincrement())
name String
bggUsername String?
bggId String?
playPlayers PlayPlayer[]
ownerId String

@@unique(name: "OwnerIdName", [ownerId, name])
@@unique(name: "OwnerIdBggId", [ownerId, bggId])
@@unique(name: "OwnerIdBggUsername", [ownerId, bggUsername])
8 replies
TTCTheo's Typesafe Cult
Created by AmazingViegas on 2/19/2024 in #questions
Shadcn Toast not showing using useEffect
Thank you for the tip! I openned an issue in the lib's github. Will let you know when something happens.
10 replies
TTCTheo's Typesafe Cult
Created by AmazingViegas on 2/19/2024 in #questions
Shadcn Toast not showing using useEffect
I made this stackblitz that perfectly demonstrates my problem: https://stackblitz.com/edit/stackblitz-starters-hzwlsc?file=app%2Flayout.tsx
10 replies
TTCTheo's Typesafe Cult
Created by AmazingViegas on 2/19/2024 in #questions
Shadcn Toast not showing using useEffect
Yes, I think it really is a Sonner bug
10 replies
TTCTheo's Typesafe Cult
Created by AmazingViegas on 2/19/2024 in #questions
Shadcn Toast not showing using useEffect
And the same happens in Sonner toasts btw
10 replies
TTCTheo's Typesafe Cult
Created by AmazingViegas on 2/19/2024 in #questions
Shadcn Toast not showing using useEffect
Yes! It works when I render a toast on button click just not on useEffect
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={inter.className}>
{children}
<Toaster />
</body>
</html>
);
}
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={inter.className}>
{children}
<Toaster />
</body>
</html>
);
}
10 replies