|
Hi, I am trying to leverage the In the actual db schema, there is an and I do get back results like: which is nice, but the type hinting in the IDE is not correct. It shows |
Replies: 1 comment
|
Your type as defined expects a single edge: ArcadeEdge<Site> // contains a single edgethe The type of site in ArcadeVertex<Site>[] // a list of all vertices with in-edges to the target vertex(You also might want to look at: Also consider your query does not return When you {
location: null, // primitive?
site: [{ name: ... }] // a list of incoming vertices
}The expected return type could be: type Thing = {
location: unknown;
site: ArcadeVertex<Site>[];
};The type parameter on the
type ArcadeVertex<T extends object> = {
/** The id of the record. */
'@rid': string;
/** The category of the record. */
'@cat': 'v';
/** The type of the record. */
'@type': string;
} & T;That would extend the type provided as a parameter with the ArcadeDB record meta, but I don't think that is a part of your returned object. Sprite was "designed" this way to serve as a lower-level library to build other tools like an OGM/ORM. You could build your own If you do not want an array, say there's only one Vertex, I think perhaps wrapping the |
Your type as defined expects a single edge:
the
in()operator returns all incoming vertices.Stated another way: it starts at the vertex targeted in the query, then follows each incoming edge to collect the connected vertices.
The type of site in
Thingshould be:(You also might want to look at:
inE(), which returns all incoming Edges for the Vertex targeted in the query.)Also consider your query does not return
ArcadeVertex[]at the top level:When you query
SELECT * FROM Equipment, you’d get vertices.When you
SELECT property, in(), you’re no longer returning jus…