You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently simplifySparqlResults(sparqlResults, {minimize: bool}) exists.
The problem here is that the minimize argument only works when the query returns exactly one variable. If that's not the case the minimize argument is ignored.
This means that the return type is not clear at compile time and only at runtime. Therefore TypeScript can not help much here. This could be more strict with either an error in case of more than one variable or (better in my opinion) a dedicated function for this.
This will be breaking either way.
The text was updated successfully, but these errors were encountered:
Maybe even remove the richVal logic? Having the exact names of variables as in the query is also simple and results in way less checks / assumptions of the returning data.
richVal Logic Explanation:
When simplifySparqlResults finds variables which start the same (like item, itemLabel, itemDescription, …) they get combined into their own Record<suffix, SparqlValueRaw>. This results in the type being Record<name, ValueRaw | Record<suffix, ValueRaw>> which is not that simple anymore.
Currently
simplifySparqlResults(sparqlResults, {minimize: bool})
exists.The problem here is that the minimize argument only works when the query returns exactly one variable. If that's not the case the minimize argument is ignored.
wikibase-sdk/src/helpers/simplify_sparql_results.ts
Line 15 in e49e10b
This means that the return type is not clear at compile time and only at runtime. Therefore TypeScript can not help much here. This could be more strict with either an error in case of more than one variable or (better in my opinion) a dedicated function for this.
This will be breaking either way.
The text was updated successfully, but these errors were encountered: