edgedb-js
edgedb-js copied to clipboard
Cardinality doesn't change for stored pointers
Code The code causing the error.
const query = e.select(e.User, user => ({
color: e.str('blue'),
another: e.op(user.color, '??', 'blue'),
}));
type Out = Array<{
color: string | null;
another: string | null;
}>
Both of those use cases should result in a non-nullable string.
EdgeQL correctly reports both of these cardinalities as One, so just QB thing.
Also using e.assert_exists() doesn't make a difference.
Schema
Your application schema.
module default {
type User {
optional color: str;
}
}
Generated EdgeQL
Run the .toEdgeQL() method on your query and print the result. Then copy the generated query here.
Error or desired behavior
Copy/paste the error, or drag/drop a screenshot displaying the error message. If there's no error, describe the expected behavior.
Versions (please complete the following information):
- OS:
- EdgeDB version (e.g.
2.0): - EdgeDB CLI version (e.g.
2.0): -
edgedb-jsversion (e.g.0.20.10;): -
@edgedb/generateversion (e.g.0.0.7;): - TypeScript version:
- Node/Deno version:
Here is the PR I made for fixing the first issue (cardinality of ??).