Skip to content

feat: add TypeScript type declarations for all packages#650

Open
Rahul-R79 wants to merge 1 commit intoaccordproject:mainfrom
Rahul-R79:feat/typescript-definitions
Open

feat: add TypeScript type declarations for all packages#650
Rahul-R79 wants to merge 1 commit intoaccordproject:mainfrom
Rahul-R79:feat/typescript-definitions

Conversation

@Rahul-R79
Copy link
Contributor

closes #648

This PR adds TypeScript type declaration

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements TypeScript type declarations for all packages in the markdown-transform monorepo, addressing issue #648. The approach uses tsc --allowJs --emitDeclarationOnly to auto-generate .d.ts files from existing JSDoc annotations. The typescript package is added as a workspace-level devDependency, and a build:types script is added to each package. The types/ directory is committed to the repository and included in published package files.

Changes:

  • Adds "typescript": "^5.4.5" to the root workspace devDependencies and updates package-lock.json
  • Adds types/ directories with auto-generated .d.ts files and build:types scripts to all 8 packages
  • Makes minor JSDoc updates in markdown-template (changing @returns {ClassDeclaration} to @returns {object})

Reviewed changes

Copilot reviewed 13 out of 76 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
package.json Adds typescript as workspace devDependency
package-lock.json Installs typescript (resolves to 5.9.3), but also causes significant unintended churn (jsdoc downgrade, peer flag removals)
packages/markdown-common/package.json Adds types/ to files, "types" field, and build:types script
packages/markdown-cicero/package.json Same pattern as markdown-common
packages/markdown-html/package.json Same pattern as markdown-common
packages/markdown-template/package.json Same pattern as markdown-common
packages/markdown-transform/package.json Same pattern as markdown-common
packages/markdown-it-cicero/package.json Same pattern as markdown-common
packages/markdown-it-template/package.json Same pattern as markdown-common
packages/markdown-cli/package.json Same pattern as markdown-common
packages/markdown-html/types/lib/ToCiceroMarkVisitor.d.ts Type declaration with a Any (capital A, invalid TypeScript) return type bug
packages/markdown-transform/types/index.d.ts Top-level type declarations for markdown-transform package
packages/markdown-template/types/lib/templatemarkutil.d.ts Type declarations with a stale JSDoc description (copy-paste from adjacent function)
All other types/**/*.d.ts files Auto-generated type declarations for each package's exports
packages/markdown-common/index.js Adds @type {Record<string, Function>} JSDoc annotation to improve type inference
packages/markdown-common/lib/FromCommonMarkVisitor.js / packages/markdown-template/lib/templatemarkutil.js / packages/markdown-template/src/templatemarkutil.js Minor JSDoc fixes

Signed-off-by: Rahul-R79 <rahul.devworks@gmail.com>
@Rahul-R79 Rahul-R79 force-pushed the feat/typescript-definitions branch from f8687ed to 8ce2fbd Compare March 8, 2026 08:28
@Rahul-R79
Copy link
Contributor Author

resolved the copilot suggestion :)

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.

Add Typescript types

2 participants