Hi folks,
I am trying to add an additional field ‘message’ to GraphQLErrorExtensions using module augmentation. However when I try to use error.extentions?.exception?.message, typescript indicates that message does not exit on type
Here is the code I added to graphql.d.ts
import 'graphql';
declare module 'graphql' {
export interface GraphQLErrorExtensions {
exception?: {
code?: string;
stacktrace?: ReadonlyArray<string>;
message?: string; // I am adding this new property
};
}
}
// another file
const { exception } = error.extentions
exception.message = "message" // here typescript shows error about .message does not
//exist in type {code?:string; stacktrace?: Array<string>}
Any helps would be appreciated.