Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JSDoc types for services #501

Closed
nikku opened this issue Nov 27, 2020 · 1 comment
Closed

Fix JSDoc types for services #501

nikku opened this issue Nov 27, 2020 · 1 comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@nikku
Copy link
Member

nikku commented Nov 27, 2020

What should we do?

Our existing JSDoc type definitions on services are built in a way that makes it impossible for IDEs to use, cf. Canvas for example:

/**
 * The main drawing canvas.
 *
 * @class
 * @constructor
 *
 * @emits Canvas#canvas.init
 *
 * @param {Object} config
 * @param {EventBus} eventBus
 * @param {GraphicsFactory} graphicsFactory
 * @param {ElementRegistry} elementRegistry
 */
function Canvas(....) {

Fixing these types by pointing to the actual implementations allows us to TypeScript type hinting to find potential miss-use:

/** @typedef { { container?: DOMElement, ... } } CanvasConfig */

/**
 * The main drawing canvas.
 *
 * @class
 * @constructor
 *
 * @emits Canvas#canvas.init
 *
 * @param {CanvasConfig} config
 * @param {import('./EventBus')} eventBus
 * @param {import('./GraphicsFactory')} graphicsFactory
 * @param {import('./ElementRegistry')} elementRegistry
 */
function Canvas(....) {

Coming up with a way to automagically fix these would be another improvement, as we got the same issue in bpmn-js and our other toolkits, too.

Related, but not necessarily similar we should fix type definitions on service APIs.

Related, and likely required, we should integrate type linting tsc --pretty into the build.

Why should we do it?

This improves the editing experience for new contributors, allows for jump to definition on public APIs and so on.


Child of bpmn-io/bpmn-js#1002

@philippfromme
Copy link
Contributor

Closed by https://github.com/bpmn-io/internal-docs/issues/688. diagram-js@12 includes type declarations.

@bpmn-io-tasks bpmn-io-tasks bot removed the backlog Queued in backlog label Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants