'How can I dynamically set a SortDirection for Neo4j Graphql in javascript?

I'm using neo4j's graphql library and it uses enums for SortDirections, like this:

enum SortDirection {
    ASC
    DESC
}

And I would like to be able to dynamically set this from my React Native application, but I'm not sure how I would go about it because I can't just reference DESC - the closest I have come up with is making it a string, which doesn't work "DESC".

let options = { sort: { originalValue: sortDirection }, limit: 10 }

Since it's an enum and not a string, "DESC" doesn't work. But I'm not able to just write DESC because it's not a defined variable in my javascript application, any idea what to do? Thank you in advance.



Solution 1:[1]

Sorry, this was a silly mistake. The String "DESC" does seem to work!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Thingamajig