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

Use specific type-level marker to `e.shape` #1048

Closed scotttrinh closed 4 months ago

scotttrinh commented 4 months ago

Introduces a type-level marker to the return value of the $shape function. This marker is used solely for type inference to carry element, cardinality, and shape information and is not present at runtime.

We now detect this specific construct in the setToTsType (which is the actual type we alias as $infer) and just short-circuit to calculating the object shape as if the shape was wrapped in a select.