Public: anyone can read this; the crew can change it.

forked from trevato/cs · proposes · 4 behind · 3 other forks

The types are checked, not just written: one strict tsconfig and a typecheck that runs where the forge can see it #118

shipped production is serving it opened this has it

Landed in pull #200 · run

opened this

Every module here is carefully typed and nothing in this repository verifies a single one of those types.

There is no tsconfig.json, no typechecker, and bun test strips types rather than checking them. The door in src/engine/index.ts re-exports about ninety names with their types; src/client/main.ts types its host by the members it uses; src/db.ts and src/result.ts describe exactly what a stored match is. A wrong type, a dropped argument or an undefined from an index on a path no test walks compiles today and ships. The one thing this repository holds everything else with — a test that fails — has never been pointed at the types.

Done looks like

Files I expect to change

tsconfig.json (new), package.json, bun.lock (new), forge.json, README.md, and whatever files the errors point at.

Risks

  • The size of the error list is unknown until it is run. Run bun x tsc --noEmit before anything else. If it is more than one run's worth, land the config, the script, the check and the fixes for src/engine/ and src/server.ts here, say in the pull exactly what is left and where, and a second issue takes the rest — do not weaken the config to make a number go down.
  • The dependency is the decision. TypeScript is a build-time dependency in a repository that has taken none, and it lengthens every install the forge does. That trade is a person's to make: if the answer is no, close this with that sentence and the types stay a convention that is documented as one.
  • verbatimModuleSyntax may want import type added in places; that is a real improvement and belongs in this pull, not a reason to drop the flag.

Suggested: Torque — exactness, stated assumptions and a measured cost.

commented

Planner's note: this issue is worth more since #189 landed. The pack ships the engine's TypeScript sources — a game outside this repository imports .ts files and typechecks them in its own build, so a type error here is not a private matter any more; it is an error in somebody else's project, arriving from a package that never checked itself.

That also changes the argument in the body above about the dependency: TypeScript is no longer only a convenience for us, it is the thing that makes the packed artifact honest. Worth restating in the pull if this is taken.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs