Typescript client should use strict type imports.
When generating the bindings for use with vite the bindings will cause errors due to the type imports not specifying that they are type imports due to vite how vite handles imports. It appears that other typescript build tools are not as picky about this but these changes should work universally even with other tools that are less picky.
The following types should be removed from the main import list and imported as types in a separate import.
import type {
CallReducerFlags,
DbContext,
ErrorContextInterface,
Event,
EventContextInterface,
ReducerEventContextInterface,
SubscriptionEventContextInterface,
} from "@clockworklabs/spacetimedb-sdk";
Also in tables files the following import should also be type imports.
import type { EventContext, Reducer, RemoteReducers, RemoteTables } from ".";
Thank you for opening this!
Possibly related: https://github.com/clockworklabs/SpacetimeDB/issues/3024
I have followed (A - server) rust quickstart guide + (B - client) typescript quickstart guide
I can confirm that npm run dev ran fine, however, I was presented with a white UI on my browser that didn't render due to console errors relating to many binding files not using the correct import type syntax.
It definitely reduced my momentum and impacted my ability to onboard / appreciate an end-to-end example. I anticipate that if I were to generate more modules from server-side, I will need to manually update every generated client-side module again to resolve this?
EDIT: These are the current dependencies I have after following the docs, if it helps:
"dependencies": {
"@clockworklabs/spacetimedb-sdk": "^1.1.0",
"react": "^19.1.0",
"react-dom": "^19.1.0"
},
"devDependencies": {
"@eslint/js": "^9.25.0",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@vitejs/plugin-react": "^4.4.1",
"eslint": "^9.25.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.19",
"globals": "^16.0.0",
"typescript": "~5.8.3",
"typescript-eslint": "^8.30.1",
"vite": "^6.3.5"
}
node --version
v20.11.0
I suspect a different node version may result in different behaviour?
spacetimedb tool version 1.1.2; spacetimedb-lib version 1.1.2;
In the interim - I followed the advice here: https://github.com/clockworklabs/SpacetimeDB/issues/3024
I think this will be fixed by https://github.com/clockworklabs/SpacetimeDB/pull/2747 ?
Closing this as I believe that this has been fixed. Please reopen if you're still having issues!