-
Notifications
You must be signed in to change notification settings - Fork 11
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
TypeScript type errors - inlining of whereClauses in subtypes #207
Comments
Hi @rc-oxpop, Based on one of the original expectations for the way in which analysis sets and groupings were to be defined (with compound expressions being defined as combinations where clauses that have defined been defined in other identified analysis sets or groups), the model currently only expects:
The Having said that, I did run into a similar issue when I was trying to create some example groupings with non-inlined compound expressions. Ideally, the model should be able to handle both inlined compound expressions and references to other already-defined (and identified) analysis set/group where clauses. In the LinkML GitHub repo, I have found reference to a construct such as:
but I haven't (yet) been able to get this to work without error when using the LinkML converter to convert from YAML to JSON format. Another issue has been raised relating to this (#136) with the expectation that we'll do some additional testing to see if it's feasible to define compound expressions for analysis sets and groupings only with reference to Does this give you enough information to continue with your TypeScript development? (PS - if possible, please raise any additional hackathon-related issues in the hackathon repo. This'll help us with issue curation. Thanks!) |
Hi! As part of the hackathon I'd like to play around with this model in TypeScript. LinkML has a generator for TypeScript types and interfaces:
gen-typescript .\model\ars_ldm.yaml > model/ars_ldm.ts
but the resulting code (via TypeScript Playground) has a few type mismatch errors.
The reason for this seems to be that in the generated interface
WhereClauseCompoundExpression
, thewhereClauses
property has been inlined (and hence has typeWhereClause[]
in the output TS), whereas inCompoundSetExpression
andCompoundGroupExpression
, it's not inlined, and so thewhereClauses
properties there have types which are aliases ofstring[]
(i.e. they're lists of ids).I think this is because in
CompoundSetExpression
andCompoundGroupExpression
, thewhereClauses
slot usage is overridden to haveinlined: false
, whereas in general,where_clauses
is inlined (necessarily, sinceWhereClause
has no identifier). Setting thewhereClauses
slots forCompoundSetExpression
andCompoundGroupExpression
to be inlined as lists fixes the type errors in the generated TypeScript.Would inlining the
whereClauses
slots for those two classes cause problems anywhere else? Or is there a better fix somewhere? I'm happy to raise a PR to fix if you think appropriate.The text was updated successfully, but these errors were encountered: