Right now I am doing this:
import { comment } from "forms";
const QUERY_COMMENTS = gql`
query QUERY_COMMENTS($projectId:Int! $orderBy:CommentOrderByInput) {
comments(projectId:$projectId orderBy:$orderBy) {
${comment}
}
}
`;
export const comment = `
id
text
date
postedBy {
id
name
}
`;
interface comment {
id:number,
text:string,
date:string,
postedBy: {
id:number,
name:string,
},
}
I basically repeat myself.
IMO it should be possible and be very useful to use typescript definitions in graphql-queries.
Yet I did not find a way to do it.