Skip to content

Instantly share code, notes, and snippets.

@mizdra
Created August 21, 2019 08:16
Show Gist options
  • Save mizdra/6e4e29e7dac91de7223aa7d46e9d7d54 to your computer and use it in GitHub Desktop.
Save mizdra/6e4e29e7dac91de7223aa7d46e9d7d54 to your computer and use it in GitHub Desktop.
`is` で絞込むやつ
type Modify<T, K extends keyof T, Value> = Pick<T, Exclude<keyof T, K>> &
{
[P in K]: Value
}
function isError<TData, TVariables>(
result: QueryResult<TData, TVariables>,
): result is Modify<typeof result, 'error', ApolloError> {
return !!result.error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment