When using REST data, our interfaces in Typescript React would appear like the following:
interface User {
id: number;
name: string;
credentials: UserCredentials
}
interface UserCredentials {
id: number;
value: string;
}
However when we obtain the graphQL data from Relay, it appears as so:
query UserQuery {
users {
edges {
node {
id
name
credentials {
edges {
node {
id
value
}
}
}
}
}
}
}
}
I'd prefer to work with objects using the interfaces we have created, not those supplied by Relay's types. Other than creating a new User object after query retrieval, is there a better way to reconcile the differences between what Relay gives us and what we are working with? Or is everyone mapping over "edges" to render their data?