edgedb-js icon indicating copy to clipboard operation
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

Open scotttrinh opened this issue 5 months ago • 0 comments

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.

scotttrinh avatar Jan 26 '24 15:01 scotttrinh