edgedb / edgedb-js

The official TypeScript/JS client library and query builder for EdgeDB
https://edgedb.com
Apache License 2.0
514 stars 65 forks source link

Fix `$infer` for `e.shape` #1044

Closed scotttrinh closed 4 months ago

scotttrinh commented 4 months ago

We were "faking" a TypeSet as part of the return type of e.shape to allow using $infer on e.shape expressions, but it turns out that caused the recent change to allow setting properties on a shape to a TypeSet as long as it agrees with the cardinality of the pointer to break.

There are some lingering issues here that we should clean up, such as making the cardinality of $infer<typeof someShape> something reasonable rather than trying to infer it from the shape since that will depend on it's actual usage. In practice, most people want the Cardinality.ONE version (so, without null and not an array) so perhaps we can change this in a break version in the future.