- name
- d3-f-impl-ts
- description
- TypeScript — writing and typechecking TypeScript that runs without a build step. Get skills only from /api/v2/skills/d3.
- feature
- impl
- concepts
- [typescript]
- tags
- #skill #feature #d3skill
- project
- d2spec
d3-f-impl-ts¶✎ edit
Intro¶✎ edit
TypeScript: writing it and typechecking it.
What a builder needs on an implementation written in TypeScript that Node runs directly, with types stripped and no build step. Node itself: d3-f-impl-node. Implementations: d3-f-impl.
Essentials¶✎ edit
- R-ts-1 MUST typecheck before you merge: a release that doesn't typecheck is refused.
- R-ts-2 Only syntax that can be erased: NEVER enums, namespaces or constructor parameter properties.
- R-ts-3 Code that realises a behaviour carries
// covers: <code>— the behaviour's code, never an item number.
Concepts¶✎ edit
typescript¶✎ edit
The implementation's language. Fields: the typecheck command (<typecheck>); imports with explicit .ts extensions.
typescript_write¶✎ edit
- Summary: erasable syntax only, explicit
.tsimports,// covers:on what realises a behaviour. - When: writing or changing code.
- Needs: the behaviour codes your ticket names.
- Call:
import { x } from "./x.ts"·// covers: waitlist-1above the code that keeps that promise. - Rules: R-ts-2, R-ts-3. No new runtime dependency unless the ticket says so. Copy the nearest existing component the ticket points at rather than inventing a shape.
- Errors: —
- Gotchas: —
typescript_check¶✎ edit
- Summary: typecheck before you merge; fix every error, yours or not, that your change surfaced.
- When: before each merge, and after resolving a conflict.
- Needs: the dependencies installed (d3-f-impl-node › npm_install).
- Call:
<typecheck>in<implDir>. - Rules: R-ts-1.
- Errors: —
- Gotchas: A deploy typechecks too and refuses the release — after everyone has merged; yours is the cheap place to find it.