Skip to content

fix(*): align remaining types and publish runtime follow-up - #671

Merged
mttrbrts merged 1 commit into
accordproject:feat/tighten-typescript-typesfrom
Rishabh060105:Rishabh060105/pr669-followup-fixes
May 10, 2026
Merged

fix(*): align remaining types and publish runtime follow-up#671
mttrbrts merged 1 commit into
accordproject:feat/tighten-typescript-typesfrom
Rishabh060105:Rishabh060105/pr669-followup-fixes

Conversation

@Rishabh060105

Copy link
Copy Markdown
Contributor

Follow-up to #669

This PR is a focused follow-up on top of #669 to address the remaining gaps found during review.

Changes

Flags

Screenshots or Video

  • Not applicable

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to feat/tighten-typescript-types from Rishabh060105/pr669-followup-fixes

Validation

  • npm run build --workspace packages/markdown-template
  • npm run build --workspace packages/markdown-html
  • npm run lint --workspace packages/markdown-template
  • npm run lint --workspace packages/markdown-html
  • npm test --workspace packages/markdown-template
  • npm test --workspace packages/markdown-html

Signed-off-by: Rishabh Jain <rishabhj2005@gmail.com>
@mttrbrts
mttrbrts merged commit 7af1052 into accordproject:feat/tighten-typescript-types May 10, 2026
2 checks passed
mttrbrts added a commit that referenced this pull request Jun 2, 2026
…ete types (#669)

* feat: tighten TypeScript type declarations — replace `any` with concrete types

Update JSDoc @PARAM and @returns annotations on the priority public API
methods across four packages so that generated .d.ts files no longer
use `any` where a more specific type is known:

- CommonMarkTransformer: toMarkdown, removeFormatting (object input),
  toTokens (object[] return), fromTokens (object[] param, object return),
  getSerializer (Serializer return)
- CiceroMarkTransformer: getClauseText, fromCiceroEdit, fromCommonMark,
  toMarkdown, toCommonMark, toCiceroMarkUnwrapped (object I/O),
  toTokens/fromTokens (object[]/object), getSerializer (Serializer)
- HtmlTransformer: toHtml (object input), toCiceroMark (object return)
- TemplateMarkTransformer: getSerializer (object return)

Regenerated .d.ts files in each package with `tsc`.

Closes #668

Signed-off-by: Matt Roberts <matt@rbrts.uk>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Matt Roberts <code@rbrts.uk>

* feat: tighten types for ToMarkdownVisitor and TransformEngine

- ToMarkdownVisitor.toMarkdown: {*} input → {object}
- TransformEngine.transformToDestination/transform: source {*} → {object|string},
  returns {*}/{Promise} → {Promise<object|string>}
- TransformEngine.registerTransformation: transform {*} → {Function}
- TransformEngine.registerExtension: extension {*} → {object}
- transform.js module exports: add JSDoc to formatDescriptor, transform,
  generateTransformationDiagram, and builtinEngine so tsc can emit
  typed declarations rather than any

Regenerated .d.ts files in markdown-common and markdown-transform.

Signed-off-by: Matt Roberts <matt@rbrts.uk>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Matt Roberts <code@rbrts.uk>

* feat(markdown-common): generate TypeScript model interfaces from CTO schemas

Add a codegen script that runs TypescriptVisitor over all four CTO models
(CommonMark, CiceroMark, ConcertoMeta, TemplateMark) and writes clean
.d.ts files to types/model/. The build:types script now runs codegen
before tsc so model types are always up to date.

Update JSDoc @typedef annotations in CommonMarkTransformer and
CiceroMarkTransformer to reference the generated interfaces (IDocument,
INode, IClause) via package-qualified paths, so tsc emits non-relative
imports that resolve correctly from any consumer package.

Result: all public API methods now carry specific model types in their
generated .d.ts signatures rather than plain object.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Matt Roberts <code@rbrts.uk>

* fix(markdown-common): remove unnecessary strict option from ModelManager in codegen script

strict mode is the default in concerto-core v4.

Signed-off-by: Matt Roberts <code@rbrts.uk>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Matt Roberts <code@rbrts.uk>

* fix: make parameters optional in JSDoc and bump minimum Node to 22

- Mark `parameters` as `[parameters]` (optional) in JSDoc for
  `transform.js` and `transformEngine.js` (src/ and lib/) so generated
  `.d.ts` files emit `parameters?: object` instead of `parameters: object`
- Update minimum Node version from >=18/>=15 to >=22 in all package.json
  engines fields
- Remove Node 20.x from CI build matrix (minimum is now 22)
- Regenerate `types/` declarations to reflect optional parameters

Signed-off-by: Copilot <copilot@github.com>

Agent-Logs-Url: https://github.com/accordproject/markdown-transform/sessions/b58c7539-b316-4d97-b13c-bde57770d0b7

Co-authored-by: mttrbrts <7544022+mttrbrts@users.noreply.github.com>

* fix(*): align remaining types and publish runtime (#668) (#671)

Signed-off-by: Rishabh Jain <rishabhj2005@gmail.com>

---------

Signed-off-by: Matt Roberts <matt@rbrts.uk>
Signed-off-by: Matt Roberts <code@rbrts.uk>
Signed-off-by: Rishabh Jain <rishabhj2005@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Rishabh060105 <160598562+Rishabh060105@users.noreply.github.com>
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.

2 participants