Skip to content

Instantly share code, notes, and snippets.

@rricard
Last active December 7, 2016 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rricard/f84d20827528e8687ff62a4ca398471c to your computer and use it in GitHub Desktop.
Save rricard/f84d20827528e8687ff62a4ca398471c to your computer and use it in GitHub Desktop.
import {
HeroNameQueryVariables,
HeroNameQuery,
} from './schema';
// ...
const variables: HeroNameQueryVariables = {
episode: 'JARJAR',
};
// [ts] Type '{ episode: "JARJAR"; }' is not assignable to type 'HeroNameQueryVariables'.
// Types of property 'episode' are incompatible.
// Type '"JARJAR"' is not assignable to type 'Episode'.
client.query({
query: graphqlDocuments['DescribeHero.graphql'],
variables,
})
.then(({data}: {data: HeroNameQuery}) => {
data.hero.friends.forEach(friend => console.log(friend.name));
// [ts] Property 'friends' does not exist on type 'DescribeHeroFragment'.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment