Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript] spacetime generate should generate .js files, not .ts #1976

Open
bfops opened this issue Nov 8, 2024 · 0 comments
Open

[TypeScript] spacetime generate should generate .js files, not .ts #1976

bfops opened this issue Nov 8, 2024 · 0 comments
Assignees

Comments

@bfops
Copy link
Collaborator

bfops commented Nov 8, 2024

If a user is working with a non-typescript project, they simply cannot use the bindings generated by spacetimedb. Hence, we should generate .js files as bindings. We can type the files in 2 ways:

  • JSDoc: JSDoc are types-in-comments, and work well too!
  • .js + .d.ts: THis will be a bit more complicated, but it requires generating 2 files, .js with all the logic, and .d.ts with the correct types specified, TypeScript will automatically combine the two while checking.

Best of both worlds

We scan through user's files and if we see .ts files, we generate .ts by default. Otherwise switch to .js(or .js+.d.ts). Can be overriden by a CLI flag (--use-typescript)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants