Skip to content

chore!: prefer interfaces over types for public type definitions#3517

Merged
tbouffard merged 2 commits into
masterfrom
chore/export_missing_types_and_prefer_interfaces_over_types
May 11, 2026
Merged

chore!: prefer interfaces over types for public type definitions#3517
tbouffard merged 2 commits into
masterfrom
chore/export_missing_types_and_prefer_interfaces_over_types

Conversation

@tbouffard
Copy link
Copy Markdown
Member

Convert public type-alias declarations to interface declarations so that consumers can augment them via
TypeScript declaration merging. This unlocks extension by downstream libs such as bpmn-visualization-addons
without forking the types.

The eslint rule @typescript-eslint/consistent-type-definitions was previously disabled. Removing the disable
lets the default prefer-interface configuration take effect and keeps future declarations consistent.

Also surface a couple of types and tighten the API documentation:

  • export BpmnGraph and Disposable (as types) so consumers can reference them directly;
  • silence typedoc warnings: unused @param entries on the destructured parameter of
    IconPainter.newBpmnCanvas, unresolved {@link} references, mismatched param names;
  • add a type-only test under test/typescript-support/ proving BpmnGraph is reachable from a consumer
    package and that mxGraph-derived members (graph.view.revalidate(), graph.getStylesheet()) compile.

BREAKING CHANGE:

  • Public types previously declared with `type X = { ... }` are now `interface X { ... }`. Object-shape
    usages (Pick, Omit, intersection with `&`, `extends`) are unaffected. Consumers relying on type-alias-only
    semantics (e.g. assignability of a union/tuple alias) would need to adapt, though no such usage is known.

Convert public type-alias declarations to `interface` declarations so that consumers can augment them via
TypeScript declaration merging. This unlocks extension by downstream libs such as `bpmn-visualization-addons`
without forking the types.

The eslint rule `@typescript-eslint/consistent-type-definitions` was previously disabled. Removing the disable
lets the default `prefer-interface` configuration take effect and keeps future declarations consistent.

Also surface a couple of types and tighten the API documentation:
- export `BpmnGraph` and `Disposable` (as types) so consumers can reference them directly;
- silence typedoc warnings: unused `@param` entries on the destructured parameter of
  `IconPainter.newBpmnCanvas`, unresolved `{@link}` references, mismatched param names;
- add a type-only test under `test/typescript-support/` proving `BpmnGraph` is reachable from a consumer
  package and that mxGraph-derived members (`graph.view.revalidate()`, `graph.getStylesheet()`) compile.

BREAKING CHANGE:
- Public types previously declared with \`type X = { ... }\` are now \`interface X { ... }\`. Object-shape
  usages (Pick, Omit, intersection with \`&\`, \`extends\`) are unaffected. Consumers relying on type-alias-only
  semantics (e.g. assignability of a union/tuple alias) would need to adapt, though no such usage is known.
@tbouffard tbouffard added the chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...) label May 11, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

♻️ PR Preview 5f53374 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

♻️ PR Preview 5f53374 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

It was using a TypeScript syntax not supported by TS v4
@tbouffard tbouffard added the skip CI e2e tests GitHub Actions do not run e2e tests (for Pull Requests) label May 11, 2026
@sonarqubecloud
Copy link
Copy Markdown

@tbouffard tbouffard enabled auto-merge (squash) May 11, 2026 14:45
@tbouffard tbouffard merged commit 1e52d6a into master May 11, 2026
17 checks passed
@tbouffard tbouffard deleted the chore/export_missing_types_and_prefer_interfaces_over_types branch May 11, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...) skip CI e2e tests GitHub Actions do not run e2e tests (for Pull Requests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant