clockworklabs / clockworklabs/SpacetimeDB

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

Open
#1,976 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the spacetime generate command and trace the current TypeScript binding generation. Decide how non-TypeScript projects receive JavaScript bindings and how the --use-typescript flag preserves the existing behavior; done means the selected output format is generated correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
cli, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.