cognite-sdk-js
cognite-sdk-js copied to clipboard
type generator error
The problem
The instances/query endpoint returns a QueryResponse that looks like this:
type QueryResponse = {
items: Record<string, NodeOrEdge>;
nextCursor: Record<String, String>
}
This is non-standard and deviates from the service contract design doc, and causes the type generator to fail
Specifically, it seems like it's expecting that the QueryResponse node is of type arrayTypeNode, but it's considered a typeReferenceNode
What we've tried so far
- Create an exception for cases where we have a
typeReferenceNode. Intuitively, it seems like it should be possible to extract theitemsandnextCursornodes, but we're not sure how. I'm also not sure if this type ofnextCursor, which isRecord<String, String>is supported.
Our current workaround
- Generate the types while omitting
nextCursor. Add it back manually, then excludeinstancesfrom further type generation.