-
Notifications
You must be signed in to change notification settings - Fork 732
Open
Description
Problem
useSpacetimeDBQuery returns RowType[] instead of inferring the row type from the table passed to it. There's no type safety on the returned data.
tsconst [people] = useSpacetimeDBQuery(tables.person);
// type is RowType<UntypedTableDef>[] — no autocomplete, no type checkingtables.person already carries the full type information for its rows. useSpacetimeDBQuery should be able to infer the row type from the table argument so that people is typed as { name: string }[] (or whatever the table schema defines) without needing a manual generic.
Expected behavior
tsconst [people] = useSpacetimeDBQuery(tables.person);
// type should be { name: string }[] — inferred from tables.person
people[0].name // ✅ autocomplete works
people[0].foo // ❌ type errorReproduce
Install via spacetime dev --template tanstack-ts and observe response of const [people] = useSpacetimeDBQuery(tables.person);
ts settings
...
"devDependencies": {
"oxfmt": "^0.35.0",
"oxlint": "^1.50.0",
"oxlint-tsgolint": "^0.15.0",
"turbo": "^2.8.10",
"typescript": "5.9.3"
},
...Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels