beef_pork_chicken
beef_pork_chicken
ATApache TinkerPop
Created by beef_pork_chicken on 12/21/2024 in #questions
TypeScript incomplete declaration of Traverser
This is a bit of a small (and probably dumb) question, as I'm new to TypeScript. I'm having trouble compiling my TypeScript code, translating it from Javascript. I see that toList returns an instance of Promise<Traverse[]>, which is fine and dandy, but it looks like several bits of documentation have get as an method to retrieve a specific object.
const { graph: orgDb, client: nClient } = connectNeptune();
const dept_and_div = (await orgDb.V().has('email', "[email protected]")
.inE('manages').outV().valueMap()
.with_(WithOptions.tokens).by(__.unfold()).toList());
for (const item of dept_and_div) {
if (item.get(T.label) === 'organization') {
//.........
const { graph: orgDb, client: nClient } = connectNeptune();
const dept_and_div = (await orgDb.V().has('email', "[email protected]")
.inE('manages').outV().valueMap()
.with_(WithOptions.tokens).by(__.unfold()).toList());
for (const item of dept_and_div) {
if (item.get(T.label) === 'organization') {
//.........
However, I see in the types.d.ts file that there is no such thing, even though 1) https://tinkerpop.apache.org/javadocs/current/full/org/apache/tinkerpop/gremlin/process/traversal/Traverser.html#get() does have a get function within its available methods. and 2) The way I intended to use it is that I wanted to retrieve the specific vertex and cast it into a Map object as I have done when it was in JavaScript, but it couldn't work out that way due to these issues.
class Traverser {
constructor(object: any, bulk?: number);
}
class Traverser {
constructor(object: any, bulk?: number);
}
Is there a specific TypeScript file or mechanic that I'm missing?
5 replies