Skip to content

Fix TypeScript declaration emit and strict mypy, and release 0.4.1 - #8

Merged
koehlma merged 3 commits into
mainfrom
work/agents/sidex-0.4.1
Oct 14, 2026
Merged

koehlma merged 3 commits into
mainfrom
work/agents/sidex-0.4.1

Conversation

@koehlma

@koehlma koehlma commented Oct 13, 2026

Copy link
Copy Markdown
Member

Fixes two problems in generated code and bumps all crates and @sidex packages to 0.4.1.

  • TypeScript: generated code now compiles with declaration: true and composite: true. @sidex/types exports the brand type as NominalBrand; the brand symbol itself stays private, so brands remain nominal.
  • Python: generated packages, including the vendored _sidex.py runtime, pass mypy --strict. The runtime's Pydantic hooks and inline are fully annotated.

Rationale

Since 0.4.0, every generated TypeScript type has an exported companion value whose type is inferred and contains the brand. The brand referred to a symbol that consumers could not name, so declaration emit failed with TS4023. Libraries that publish declarations, such as SDKs, could only work around this by post-processing generated code. Composite projects failed as well.

Exporting the brand type fixes this at the root, without regenerating consumer code. The alternative, emitting explicit annotations for every companion value, would make the generated code larger and still require regeneration.

The Python runtime lacked annotations on its Pydantic hooks, which forced consumers to exclude _sidex from strict type checks.

Testing

  • The Node end-to-end test now also type-checks the generated fixture with declaration: true and composite: true. The fixture covers nominal wrappers, opaque types, timestamps and dates, generics, and validate-plugin values with tryNew.
  • New Python tests run mypy --strict over generated packages.
  • Nexigon's TypeScript SDK and Python bindings, generated from its API, pass declaration emit and strict mypy without workarounds.
  • cargo test, Clippy, the Python integration tests, both TypeScript packages, and packaging/crates.py package pass locally.

Created on behalf of @koehlma by Claude Code / claude-opus-5-5 · Task

@koehlma
koehlma marked this pull request as ready for review October 14, 2026 05:35
@koehlma
koehlma merged commit 76909d1 into main Oct 14, 2026
12 checks passed
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

Successfully merging this pull request may close these issues.

1 participant