-
Notifications
You must be signed in to change notification settings - Fork 34
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
Initial typescript setup #260
Initial typescript setup #260
Conversation
* Set up TS infrastructure * Updated all files to proper TS * Add low-hanging fruit types * Used any for all complex types
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.
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.
|
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.
This is the beginning of a bright future for cql-execution!
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.
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
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.
Another comment on TS interfaces.
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.
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
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.
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
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.
@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.ts
files to make the TypeScript compiler happy. All types are now exported fromcql-execution
itself 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
tsc
overbabel
Code Changes
Core Development Changes
TypeScript
compilation with basic configuration optionstsconfig.test.json
is an extension oftsconfig.json
that allows the test to disable certain TypeScript rules on a case-by-case basisbabel
withtsc
and updated necessary build scriptsbabel.config.json
.mocharc.json
to support TypeScript testsSource Code Changes
.ts
module.exports
to useexport
orexport default
where appropriateany
for now, aside from existing classes/simple data types.d.ts
file forucum-lhc
library with basic type definitions needed forcql-execution
.js
convert-test
where improper bracket matching led to an improperly labeled testDate
class should not exist where TypeScript would have never let them exist in the first place (co-signed change by @cmoesel )Misc Changes
examples
directory (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.ts
for whatcql
is, and easily write code that deals with any of the normally-exported classes fromcql-execution
examples/node
, or usenpm link
in an existing JavaScript projectexamples/browsers/cql4browsers.html
and ensure the results for any ELM are the same as the current master branchOpen Questions
@ts-ignore
comments 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-execution
in TypeScript looks likepackage.json
yet. 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:plus
to run tests, lint, and prettier)cql4browsers.js
built withyarn run build:browserify
if source changed.Reviewer:
Name: Chris Hossenlopp (@hossenlopp)