Closed
Description
in TypeScript >=2.7 (since this PR), the definition of type[]
and [type]
are different.
[type]
also enforces a length of 1
for the array, while type[]
just enforces the Array type without length.
Related to this PR: (fixed the inner array)
#1763
Actual outcome:
Field types
in IntrospectionResultData
defined as:
export type IntrospectionResultData = {
__schema: {
types: [{
kind: string;
name: string;
possibleTypes: {
name: string;
}[];
}];
};
};
Intended outcome:
It should be:
export type IntrospectionResultData = {
__schema: {
types: {
kind: string;
name: string;
possibleTypes: {
name: string;
}[];
}[];
};
};
How to reproduce the issue:
Use typescript@2.7.1
and define IntrospectionResultData
with more than one type, for example:
const cache = new InMemoryCache({
fragmentMatcher: new IntrospectionFragmentMatcher({
introspectionQueryResultData: {
__schema: {
types: [{
kind: 'UNION',
name: 'A',
possibleTypes: [
{ name: 'AA' },
{ name: 'AB' },
]
}, {
kind: 'UNION',
name: 'B',
possibleTypes: [
{ name: 'BA' },
{ name: 'BB' }
]
},
]
},
}
}),
});
As a temporary workaround, it's possible to add as any
to the types
array value.
Version
- apollo-client@2.2.2
- apollo-cache-inmemory@1.17
Metadata
Metadata
Assignees
Labels
No labels