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

ModelBaseAttrs might be missing type field #774

Closed
makepanic opened this issue Apr 12, 2023 · 1 comment · Fixed by #776
Closed

ModelBaseAttrs might be missing type field #774

makepanic opened this issue Apr 12, 2023 · 1 comment · Fixed by #776
Assignees
Labels
bug Something isn't working

Comments

@makepanic
Copy link
Contributor

Describe the Bug

Hi,
I'm trying to consume the typed diagram-js features and noticed an error when trying to port from our types to the now officially shipped ones in diagram-js@11.13.

Currently ModelBaseAttrs has no type field in its interface definition:

https://github.com/bpmn-io/diagram-js/blob/develop/lib/model/index.d.ts#L11-L18

This means e.g. according to the types when using the ElementFactory createShape method, it doesn't accept a type:

https://github.com/bpmn-io/diagram-js/blob/develop/lib/core/ElementFactory.d.ts#L47

But seeing from how we already use it this is incorrect. It's also used with a type in the bpmn properties panel, e.g.

https://github.com/bpmn-io/bpmn-js-properties-panel/blob/d91eca4bdb5a0602fb5a1858fbda8ae32e6c643d/test/spec/extension/ExamplePropertiesProvider.js#L120

If it's ok, I could change ModelBaseAttrs to also accept an optional type?: string; field.

Steps to Reproduce

Steps to reproduce the behavior:

  1. have an instance of ElementFactory
  2. call createShape({ type: 'bpmn:ServiceTask' }) on it

20230412-105845

Expected Behavior

Typescript compiler doesn't complain

Environment

Please complete the following information:

  • Browser: any (part of the compilation step)
  • OS: linux
  • Library version: 11.13.0
@makepanic makepanic added the bug Something isn't working label Apr 12, 2023
@nikku
Copy link
Member

nikku commented Apr 17, 2023

@philippfromme Let's patch this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants