Skip to content

Instantly share code, notes, and snippets.

@bengrunfeld
Created August 14, 2023 14:09
Show Gist options
  • Save bengrunfeld/5b0647b7496225d05d347d0ee6e0b36f to your computer and use it in GitHub Desktop.
Save bengrunfeld/5b0647b7496225d05d347d0ee6e0b36f to your computer and use it in GitHub Desktop.
Apollo Fragments - possibleTypes
var possibleTypes = schema.data.__schema.types
.filter(supertype => supertype.possibleTypes)
.reduce((all, supertype) => {
all[supertype.name] = supertype.possibleTypes.map(subtype => subtype.name);
return all;
}, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment