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, the whereClauses property has been inlined (and hence has type WhereClause[] in the output TS), whereas in CompoundSetExpression and CompoundGroupExpression, it's not inlined, and so the whereClauses properties there have types which are aliases of string[] (i.e. they're lists of ids).
I think this is because in CompoundSetExpression and CompoundGroupExpression, the whereClauses slot usage is overridden to have inlined: false, whereas in general, where_clauses is inlined (necessarily, since WhereClause has no identifier). Setting the whereClauses slots for CompoundSetExpression and CompoundGroupExpression 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.
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.tsbut 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, thewhereClausesproperty has been inlined (and hence has typeWhereClause[]in the output TS), whereas inCompoundSetExpressionandCompoundGroupExpression, it's not inlined, and so thewhereClausesproperties there have types which are aliases ofstring[](i.e. they're lists of ids).I think this is because in
CompoundSetExpressionandCompoundGroupExpression, thewhereClausesslot usage is overridden to haveinlined: false, whereas in general,where_clausesis inlined (necessarily, sinceWhereClausehas no identifier). Setting thewhereClausesslots forCompoundSetExpressionandCompoundGroupExpressionto be inlined as lists fixes the type errors in the generated TypeScript.Would inlining the
whereClausesslots 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.