-
Notifications
You must be signed in to change notification settings - Fork 418
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
feat: add type declarations for core components #732
Conversation
899ed38
to
427577a
Compare
Next steps:
|
427577a
to
99e2517
Compare
lib/command/CommandHandler.d.ts
Outdated
canExecute?(context: any): boolean; | ||
preExecute?(context: any): void; | ||
postExecute?(context: any): void; | ||
$inject?: string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$inject
is necessary? Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if we require it it shall be static
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was asking myself that question. I'd like to communicate somehow that a command handler is going to be instantiated by the command stack and, therefore, can use the $inject
syntax. Unfortunately, interfaces do not support static members (cf. microsoft/TypeScript#13462).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not transport that through types, but through proper documentation.
You could consider to expand the CommandHandler
documentation or write new one (docs.bpmn.io).
99e2517
to
b3f5935
Compare
Really nice stuff. I dove into this and added #744 as a potential to improve this PR. Please have a 👀. What I really like is how you created dedicated type specs (that also cover real world use-cases). This way we can build out types on a real world use-case / demand basis. |
Consider splitting up existing type tests so the file does not get HUGE at some point. |
I'm looking into this today. Sorry for delay. |
In the end, I deprioritized this for this week ^^ |
As discussed with @nikku we will:
|
@philippfromme Looks like you're still making progress on this item. Let's chat tomorrow what is left open / the status of this PR. Happy to review (if it makes sense) tomorrow. |
a9ea7f6
to
6825273
Compare
Fixes some type declarations.
897bc70
to
e7d1a18
Compare
* fix @param types * fix formatting
e7d1a18
to
9a9fc75
Compare
I will look into it today |
import CoreModule from '.'; | ||
import ElementFactory from '../../core/ElementFactory'; | ||
|
||
import ModelingModule from '.'; | ||
import Modeling from './Modeling'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CoreModule
and ModelingModule
import the same thing here. Because the test suceeds, I assume we don't actually need the Core Module here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dropped it with 81d861e and it works fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the same thing indeed 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooopsie. Good catch! The tests don't fail because errors due to missing modules can only happen during runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simplified some import paths and fixed some typos. Can you confirm that #732 was just a copy/paste issue and not something fundamental?
Other than that, I am happy to merge it 🎉
Great stuff @philippfromme and great review @marstamm 🎉. Let's get this merged @philippfromme? |
* options are optional * core module is added by default
I just added a last simplification. Let's merge! |
🎉 |
Includes TypeScript declarations for
lib/command/*
lib/core/*
lib/model/*
lib/draw/BaseRenderer
lib/features/modeling/Modeling
lib/features/modeling/Overlays
Related to #78
Related to https://github.com/bpmn-io/internal-docs/issues/688