Skip to content

Generate types#90

Draft
nikku wants to merge 9 commits into
mainfrom
generate-types
Draft

Generate types#90
nikku wants to merge 9 commits into
mainfrom
generate-types

Conversation

@nikku
Copy link
Copy Markdown
Member

@nikku nikku commented Sep 19, 2025

Proposed Changes

This PR adds type definitions to this library, following the established "generation" pattern known from diagram-js and bpmn-js.

  • Add a generate-types task
  • Generate types from src, not from lib
  • Copy types over to lib during the process (lib is what is being released to users)
  • Be able to test types following our established pattern
  • Going the first steps to fix existing type defintions

Related to bpmn-io/dmn-js#937

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

The question is if this is "ready to be released" by any means; there is many places where the types are incomplete / insufficient. To find that out I want to give the types a test run (release a pre-release, integrate with dmn-js).

@nikku nikku self-assigned this Sep 19, 2025
@bpmn-io-tasks bpmn-io-tasks Bot added the needs review Review pending label Sep 19, 2025
@nikku nikku requested a review from Copilot September 19, 2025 17:43
Copy link
Copy Markdown

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 adds TypeScript type generation capabilities to the table-js library, following established patterns from diagram-js and bpmn-js. The changes include setting up tooling to generate types from source code and improving existing type definitions.

  • Add type generation workflow using bio-dts tool with testing capabilities
  • Update JSDoc type annotations to use proper TypeScript conventions
  • Add generic type parameters to component classes for better type safety

Reviewed Changes

Copilot reviewed 10 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
package.json Adds type generation scripts, dependencies (bio-dts, cpx2, typescript), and updates CI workflow
.github/workflows/CI.yml Updates diagram-js version dependency from 11 to 12
src/features/editor-actions/EditorActions.js Updates JSDoc type annotation from "Unknown" to "unknown"
src/features/context-menu/components/ContextMenuComponent.js Restructures JSDoc parameter documentation for better type clarity
src/components/utils/mixin.js Adds Component typedef import for better type definitions
src/components/BaseCell.js Adds generic type parameters and constructor parameter types
src/components/HeaderCell.js Adds generic type parameters and state type annotation
src/components/Cell.js Adds generic type parameters and state type annotation
src/components/DiContainer.js Adds generic type parameters with injector constraint
src/components/Cell.spec.tsx Adds TypeScript test file demonstrating generic type usage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

diagram-js<=11 does not offer type definitions, and hence the checks fail.
Comment thread package.json
"generate-types:generate": "del-cli \"{src,lib}/**/*.{d.ts,d.ts.map}\" && npx bio-dts --jsx -r src --outDir src && cpx \"src/**/*.{d.ts,d.ts.map}\" lib",
"generate-types:test": "tsc --noEmit --noImplicitAny",
"auto-build": "babel -s -d lib src --watch",
"prepublishOnly": "run-s build"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we are to publish the types, they should be part of prepare or prepublish, e.g.

Suggested change
"prepublishOnly": "run-s build"
"prepare": "run-s build generate-types"

Also, the types should be copied over to (or created directly in) the build directory (lib).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Marked this as draft and will cut a pre-release next to aid testing against dmn-js.

@nikku nikku marked this pull request as draft September 26, 2025 09:26
@bpmn-io-tasks bpmn-io-tasks Bot added in progress Currently worked on and removed needs review Review pending labels Sep 26, 2025
@nikku nikku added the ready Ready to be worked on label Oct 2, 2025 — with bpmn-io-tasks
@nikku nikku removed the in progress Currently worked on label Oct 2, 2025
@nikku nikku added the backlog Queued in backlog label Nov 20, 2025 — with bpmn-io-tasks
@nikku nikku removed the ready Ready to be worked on label Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backlog Queued in backlog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants