Skip to content

Instantly share code, notes, and snippets.

@balazsorban44
Last active September 24, 2020 16:43
Show Gist options
  • Save balazsorban44/352d5295f604fb4274bfc934937737a1 to your computer and use it in GitHub Desktop.
Save balazsorban44/352d5295f604fb4274bfc934937737a1 to your computer and use it in GitHub Desktop.
// I wish this file to be generated from my *.gql files
declare module '*/queries.gql' {
export const Something: string;
export const SomethingElse: string;
}
import {Something} from "./queries.gql"
console.log(Something)
/**
* Prints (minified or not)
*
* query Something {
* name
* id
* }
*/
fetch("http://example.com/graphql", {
method: "POST",
headers: {
"Content-Type": "application-json"
},
body: JSON.stringify({query: SomethingElse, variables: {var: ""}})
})
query Something {
name
id
}
query SomethingElse($var: String!) {
somethingelse($var) {
phone
... SomeFragment
}
}
fragment SomeFragment {
email
address
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment