You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Repo] Auto-generate packages/affine-{js,ts}/types.d.ts from compiler output #66
Two .d.ts files describe the public AffineScript API surface for downstream JS/TS consumers:
packages/affine-js/types.d.ts
packages/affine-ts/types.d.ts
They're hand-maintained today, which means:
They're listed as "approved TypeScript exemptions" in .claude/CLAUDE.md, which is a policy solution to a technical problem.
They drift from the actual compiler-emitted JS shape over time.
Each new public type/function in canonical AffineScript needs a manual .d.ts update.
The fix moves the .d.ts files from "policy violation" to "build artefact" — generate them from the canonical compiler's IR or codegen pass, treat them as compiler output, drop the exemption.
Acceptance criteria
Compiler emits .d.ts for any module flagged for JS/TS export (mechanism TBD: annotation, file-scope, separate manifest).
packages/affine-js/types.d.ts and packages/affine-ts/types.d.ts are removed from the source tree and added to .gitignore if they're build outputs, or generated into dist/ and consumed from there.
CI rebuilds them on every change to the public API.
Drop the two types.d.ts rows from the TypeScript Exemptions table in .claude/CLAUDE.md.
Notes on scope
This isn't urgent — the hand-maintained files work today. But it's the cleanest way to retire the exemption permanently, and shares infrastructure with whatever Node-target codegen (#35) ends up emitting.
Closing as won't-do. Decision context: TypeScript is not a first-class consumer in the AffineScript ecosystem. Having a dedicated TS package (hand-maintained or auto-generated) surfaces TS where it shouldn't be.
The packages/affine-ts package is being removed in PR #95. With it gone, this issue's scope shrinks to just auto-generating packages/affine-js/types.d.ts, which is a smaller, separate decision — file a new issue if that's worth pursuing.
The remaining packages/affine-js/types.d.ts exemption (the JS callers' interop surface, which is unavoidably .d.ts-syntax because the format is TS by definition) is preserved as-is.
Activity
hyperpolymath commentedon May 11, 2026
Closing as won't-do. Decision context: TypeScript is not a first-class consumer in the AffineScript ecosystem. Having a dedicated TS package (hand-maintained or auto-generated) surfaces TS where it shouldn't be.
The
packages/affine-tspackage is being removed in PR #95. With it gone, this issue's scope shrinks to just auto-generatingpackages/affine-js/types.d.ts, which is a smaller, separate decision — file a new issue if that's worth pursuing.The remaining
packages/affine-js/types.d.tsexemption (the JS callers' interop surface, which is unavoidably.d.ts-syntax because the format is TS by definition) is preserved as-is.chore(packages): remove affine-ts; close #66 won't-do (#95)
chore(rescript): remove the 4 orphan .res files + the affine-res pack…