-
Notifications
You must be signed in to change notification settings - Fork 874
Open
Description
In my case I am trying to run this query:
SELECT u.* FROM user u
JOIN lobby_join lj
ON u.id = lj.user
WHERE lj.host = ${lobbyHostId.toHexString()}The corresponding statement in TS is (I THINK):
const [joinedUsers, joinedUsersReady] = useTable(
tables.user.leftSemijoin(tables.lobby_join, (user, join) =>
and(user.id.eq(join.user), join.host.eq(lobbyHostId))
)
);but this unfortunately doesn't work:
join.host.eq(lobbyHostId) yields this massive error:
Argument of type 'BooleanExpr<TableToSchema<"lobby_join", TableSchema<CoerceRow<{ user: IdentityColumnBuilder<{ isPrimaryKey: true; }>; host: IdentityBuilder; }>, [{ readonly name: "host"; readonly algorithm: "btree"; readonly columns: readonly [...]; }, { ...; }]>>>' is not assignable to parameter of type 'BooleanExpr<TableToSchema<"lobby_join", TableSchema<CoerceRow<{ user: IdentityColumnBuilder<{ isPrimaryKey: true; }>; host: IdentityBuilder; }>, [{ readonly name: "host"; readonly algorithm: "btree"; readonly columns: readonly [...]; }, { ...; }]>> | TableToSchema<...>>'.
Types of property 'data' are incompatible.
Type 'BooleanExprData<TableToSchema<"lobby_join", TableSchema<CoerceRow<{ user: IdentityColumnBuilder<{ isPrimaryKey: true; }>; host: IdentityBuilder; }>, [{ readonly name: "host"; readonly algorithm: "btree"; readonly columns: readonly [...]; }, { ...; }]>>>' is not assignable to type 'BooleanExprData<TableToSchema<"lobby_join", TableSchema<CoerceRow<{ user: IdentityColumnBuilder<{ isPrimaryKey: true; }>; host: IdentityBuilder; }>, [{ readonly name: "host"; readonly algorithm: "btree"; readonly columns: readonly [...]; }, { ...; }]>> | TableToSchema<...>>'.
Type '{ type: "eq" | "ne" | "gt" | "lt" | "gte" | "lte"; left: ValueExpr<TableToSchema<"lobby_join", TableSchema<CoerceRow<{ user: IdentityColumnBuilder<{ isPrimaryKey: true; }>; host: IdentityBuilder; }>, [...]>>, any>; right: ValueExpr<...>; } & { ...; }' is not assignable to type 'BooleanExprData<TableToSchema<"lobby_join", TableSchema<CoerceRow<{ user: IdentityColumnBuilder<{ isPrimaryKey: true; }>; host: IdentityBuilder; }>, [{ readonly name: "host"; readonly algorithm: "btree"; readonly columns: readonly [...]; }, { ...; }]>> | TableToSchema<...>>'.
Type '{ type: "eq" | "ne" | "gt" | "lt" | "gte" | "lte"; left: ValueExpr<TableToSchema<"lobby_join", TableSchema<CoerceRow<{ user: IdentityColumnBuilder<{ isPrimaryKey: true; }>; host: IdentityBuilder; }>, [...]>>, any>; right: ValueExpr<...>; } & { ...; }' is not assignable to type '{ type: "eq" | "ne" | "gt" | "lt" | "gte" | "lte"; left: LiteralExpr<any>; right: LiteralExpr<any>; } & { _tableType?: TableToSchema<"lobby_join", TableSchema<CoerceRow<{ user: IdentityColumnBuilder<{ isPrimaryKey: true; }>; host: IdentityBuilder; }>, [...]>> | TableToSchema<...> | undefined; }'.
Type '{ type: "eq" | "ne" | "gt" | "lt" | "gte" | "lte"; left: ValueExpr<TableToSchema<"lobby_join", TableSchema<CoerceRow<{ user: IdentityColumnBuilder<{ isPrimaryKey: true; }>; host: IdentityBuilder; }>, [...]>>, any>; right: ValueExpr<...>; } & { ...; }' is not assignable to type '{ type: "eq" | "ne" | "gt" | "lt" | "gte" | "lte"; left: LiteralExpr<any>; right: LiteralExpr<any>; }'.
Types of property 'left' are incompatible.
Type 'ValueExpr<TableToSchema<"lobby_join", TableSchema<CoerceRow<{ user: IdentityColumnBuilder<{ isPrimaryKey: true; }>; host: IdentityBuilder; }>, [{ readonly name: "host"; readonly algorithm: "btree"; readonly columns: readonly [...]; }, { ...; }]>>, any>' is not assignable to type 'LiteralExpr<any>'.
Property 'value' is missing in type 'ColumnExpression<TableToSchema<"lobby_join", TableSchema<CoerceRow<{ user: IdentityColumnBuilder<{ isPrimaryKey: true; }>; host: IdentityBuilder; }>, [{ readonly name: "host"; readonly algorithm: "btree"; readonly columns: readonly [...]; }, { ...; }]>>, "user">' but required in type 'LiteralExpr<any>'.
It seems like this is not just a type error, as I also get the following error in the Browser console:
❌ ERROR Received SubscriptionError for unknown querySetId 1: Error: Subscription not found: ((Identity(c200c420d63f2819bfaa86ec64559e83da558c0c14bcc896927aec28c3beedd3), ConnectionId(19d90a56ead3af6cd88d281da7938380)), QuerySetId { id: 1 })
at DbConnection.processMessage_fn (spacetimedb.js?v=45e0e47c:6693:21)
at spacetimedb.js?v=45e0e47c:6799:82
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels