Conversation
* Set up TS infrastructure * Updated all files to proper TS * Add low-hanging fruit types * Used any for all complex types
hossenlopp
left a comment
There was a problem hiding this comment.
A few comments and questions. Also currently breaks in fqm-execution, but we are actively resolving that issue on slack.
* Fix args that should have been optional * Add stricter typing of execution parameters * Switch to prepare over prepublish * Export types directory from cql.ts
Codecov Report
@@ Coverage Diff @@
## master #260 +/- ##
==========================================
- Coverage 92.43% 87.54% -4.89%
==========================================
Files 49 50 +1
Lines 4082 5035 +953
Branches 0 1415 +1415
==========================================
+ Hits 3773 4408 +635
- Misses 309 310 +1
- Partials 0 317 +317
Continue to review full report at Codecov.
|
hossenlopp
left a comment
There was a problem hiding this comment.
This is the beginning of a bright future for cql-execution!
cmoesel
left a comment
There was a problem hiding this comment.
Wowsers. That's a pretty significant PR. It is also a pretty awesome PR. I'm stoked to see TypeScript support coming into cql-execution. (I probably haven't used the word "stoked" for at least 15 years, but here we are. Huh.)
I've made a bunch of individual comments, some of which are actionable, some of which are not actionable, and some of which are actionable but also ignorable. I leave it as an exercise for the reader to figure out which is which. ;-)
One comment not in the list of individual comments: I noticed that .github/pull_request_template.md still references yarn. That file isn't in the PR, so this is the only place I can comment on it.
Thanks again for this excellent work. I'm sure it was very tedious and annoying at times. I hope you will receive your reward in the afterlife (if you believe in such a thing). Please feel free to reach out if you have any questions (about my review, that is; I'm afraid I have no further details about your reward in the afterlife).
* Fix easy type updates * Properly mark optional params Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
* Update PR template to use npm * Remove prepend flag from npm scripts * Properly mark patient attribute as potentially undefined
* Rename types files * Add strict typing to executor and context args * Update example to use typescript import with comment
ea8e9e8 to
5785caa
Compare
hossenlopp
left a comment
There was a problem hiding this comment.
Another comment on TS interfaces.
cmoesel
left a comment
There was a problem hiding this comment.
This is looking pretty awesome. Thanks for addressing my comments so quickly! I've commented back on a few of the existing comment threads and just added a few more additional comments in this review.
Thanks again for all the hard work and attention to detail!
|
@cmoesel I got a second wind and attempted a first pass at an abstract base class for I kept some TODOs in there, as I think we can take this further (e.g. improving how we access the static |
* Require _is and _typeHierarchy * Add interfaces for TypeSpecifier structures
c139c09 to
fc4f98b
Compare
cmoesel
left a comment
There was a problem hiding this comment.
This all looks really great, @mgramigna. Since a lot has changed since I first looked at this, I think I will need to run it through some regressions again w/ my other projects that use cql-execution.
* Add information about TypeScript conversion * Update examples to include TypeScript and proper JavaScript * Update CI bade to GH Actions over travis * Update command to generate cql4browsers
cmoesel
left a comment
There was a problem hiding this comment.
@mgramigna - This is the start of something beautiful. Thank you so much for your very significant contribution. The future is bright (and typed)!
Fixes #236
Summary/Motivation
This PR does the initial conversion of the library to TypeScript, without too many strict types and no runtime changes. This will significantly lower the burden of TypeScript developers wishing to use
cql-execution, as they no longer have to define custom.d.tsfiles to make the TypeScript compiler happy. All types are now exported fromcql-executionitself when publishing.Basically all of these changes will not be seen by any non-TypeScript projects consuming the library, as most of the changes are development-focused, with a few new dependencies, and using
tscoverbabelCode Changes
Core Development Changes
TypeScriptcompilation with basic configuration optionstsconfig.test.jsonis an extension oftsconfig.jsonthat allows the test to disable certain TypeScript rules on a case-by-case basisbabelwithtscand updated necessary build scriptsbabel.config.json.mocharc.jsonto support TypeScript testsSource Code Changes
.tsmodule.exportsto useexportorexport defaultwhere appropriateanyfor now, aside from existing classes/simple data types.d.tsfile forucum-lhclibrary with basic type definitions needed forcql-execution.jsconvert-testwhere improper bracket matching led to an improperly labeled testDateclass should not exist where TypeScript would have never let them exist in the first place (co-signed change by @cmoesel )Misc Changes
examplesdirectory (I am not attached to this, will be happy to remove)package.json. I thought this PR warranted it ;)Testing Guidance
The functionality of the library should be unchanged. Run all tests and usual checks
import * as cql from 'cql-execution'. You should be able to inspect the.d.tsfor whatcqlis, and easily write code that deals with any of the normally-exported classes fromcql-executionexamples/node, or usenpm linkin an existing JavaScript projectexamples/browsers/cql4browsers.htmland ensure the results for any ELM are the same as the current master branchOpen Questions
@ts-ignorecomments in here to revisit later. Some of them may be trivial to fix if the reviewer has any suggestions. Some of them might be a bit more involved though. I'm happy to expand on any of the decisions made therecql-executionin TypeScript looks likepackage.jsonyet. Will probably do so when the PR is in a stabler stateAdvice
Have fun!!!!
--
Pull requests into cql-execution require the following.
Submitter and reviewer should ✔ when done.
For items that are not-applicable, mark "N/A" and ✔.
CDS Connect and Bonnie are the main users of this repository.
It is strongly recommended to include a person from each of those projects as a reviewer.
Submitter:
yarn run test:plusto run tests, lint, and prettier)cql4browsers.jsbuilt withyarn run build:browserifyif source changed.Reviewer:
Name: Chris Hossenlopp (@hossenlopp)