-
Notifications
You must be signed in to change notification settings - Fork 4
Add type checking and fix issues #74
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
Conversation
|
@bpmn-io/modeling-dev Do you like 2 tsconfigs (one for test, one for source, +helpers) or one unified as in camunda/camunda-modeler#5186 more? |
| * @property {string} [detail] longer description of the variable content | ||
| * @property {boolean} [isList] whether the variable is a list | ||
| * @property {Array<Variable>} [schema] array of child variables if the variable is a context or list | ||
| * @property {boolean|'optional'} [isList] whether the variable is a list |
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.
Any idea of what it means that isList is "optional"?
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.
not quite. the tests are using both boolean values and 'optional'. I didn't want to adjust the implementation (for now) and just fix the docs to reflect the implementation (unless its obviously broken).
optional is checked here: https://github.com/bpmn-io/feel-editor/blob/39_check-types/src/autocompletion/pathExpression.js#L43
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.
Perhaps the answer is in the variable resolver. I will look for an answer in our codebase.
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.
Indeed it's coming from variable resolver, and is supposed to handle cases where a variable is created once as a list, and once as a non-list: https://github.com/bpmn-io/variable-resolver/blob/e69f839538a8368024dfcbfcef7e56e64b53713a/lib/base/VariableResolver.js#L346
So essentially variable: T[] | U
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.
Meaning: The variable can be a list, but does not have to.
Do we even want to typecheck the tests? What is the benefit? |
we don't have to typecheck them, but having a tsconfig for tests helps with autocompletion and intellisense. By having two separate configs we could adjust the CI to only enforce one, or check tests less strict. even though I would like to check everywhere with the same config. Checking tests as well helps validating additional constraints, ie. if I would have just checked |
|
Thanks for the clarification. Can we then have 2 tsconfig files: one for source code, one for tests? Currently, I see 4 files listed. |
the base helper is needed to share configs between the src and test. the main tsconfig is an easier entry point for ides and commands, but could be adjusted to just have two tsc commands. Cf b74e767 with some duplicated configs Note: this only works if test and src are separate, eg in camunda-modeler this wouldn't work as we have |
|
I've just pushed 1c40800 which I think is the simplest config we can maintain. Two separate config files but the source one includes most of the configuration. WDYT? |
barmac
left a comment
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.
✅ from me. Great work
|
the problem with 1c40800 is that vscode then doesn't work in test (eg no intellisense, no type checking), only the cli works |
|
i applied your idea of extending source in fa846d8 |
|
OK but it works with ed69c6d |
|
yeah, its the same. then i'm fine with it |
I missed that, but generally I think tsconfig should be placed in the root unless it's a test-specific config. |
|
i'll go ahead and squash the commits and force push |
ed69c6d to
add0cb7
Compare
Co-authored-by: Maciej Barelkowski <maciej.barelkowski@camunda.com>
Closes #39
add0cb7 to
6683037
Compare
|
@barmac are you happy with the config now, I'm planning to apply the same also to other projects (where we have separate src/test folders) |
|
Absolutely! Great work |
Closes #39
Proposed Changes
completeFromListto convert snippetCompletion[]toCompletionSource[]Try out
install and try the new script
check-typescurrently no errors should be found
try to adjust jsdoc params in a ts capable editor, you should get in editor errors
if you prefer cli only just run the script again to see the errors
Checklist
To ensure you provided everything we need to look at your PR:
@bpmn-io/srtoolCloses {LINK_TO_ISSUE}orRelated to {LINK_TO_ISSUE}