edgedb-js
edgedb-js copied to clipboard
Link property type of overloaded link with multiple levels of inheritance are not being typed properly in the query builder
GIven this schema:
module default {
type User;
abstract type Question;
type HealthQuestion extending Question;
abstract type Reply {
required user: User;
required single question: Question;
}
abstract type UserInputReply extending Reply;
type HeightReply extending UserInputReply {
overloaded link question: HealthQuestion;
}
}
And this query builder expression:
const query = e.insert(e.HeightReply, {
question: e.select(e.HealthQuestion, (q) => ({
filter_single: e.op(
q.id,
'=',
e.cast(e.uuid, 'cb93c0e8-bc59-11ee-b4e9-733964e794b2')
),
})),
user: e.select(e.User, (u) => ({
filter_single: e.op(
u.id,
'=',
e.cast(e.uuid, 'cb93b882-bc59-11ee-b4e9-f7ffc0fcad9d')
),
})),
});
The type of question is improperly being intersected in an incompatible way.
I just ran into what might be related to this issue? A simple example:
module default {
abstract type A {
name: str;
}
abstract type B extending A {}
type C extending B {
overloaded required name: str;
}
}
const query = e.select(e.default.B, (_) => ({
name: true // (property) "name"?: propDescToSelectElement<PropertyDesc<$str, Cardinality.AtMostOne, false, false, false, false>> | undefined
}))
/*
$infer<typeof query>:
{
name: string | null;
}[]
*/
const query = e.select(e.default.C, (_) => ({
name: true // (property) "name"?: propDescToSelectElement<never> | undefined
}))
/*
$infer<typeof query>:
{}[]
*/
The following at least brings back the existence of the property in the type output, but without the overloaded changes...
const query = e.select(e.default.C, (_) => ({
...e.is(e.default.A, {
name: true
})
}))