I am writing a resolve for an object defined via Graphql. Despite the response returned from a query being correct, typescript keeps giving this error
Types of property 'code' are incompatible.
Type 'string' is not assignable to type GraphQLCode.
Here is how i am trying to populate the data to be resolved by the resolver
const myArray: {
code: string;
...other fields
}[] = [];
myArray.push({
code: codeMapper[code as keyof typeof codeMapper],
...other fields
});
Here is my graphQL type
enum GraphQLCode {
SOME_VALUES
}