Skip to content

Instantly share code, notes, and snippets.

@klemola
Last active May 16, 2019 10:34
Show Gist options
  • Save klemola/dfb7baaa59b8ee10c6178618a97781a9 to your computer and use it in GitHub Desktop.
Save klemola/dfb7baaa59b8ee10c6178618a97781a9 to your computer and use it in GitHub Desktop.
export function isNotAsked<T, E>(
remoteData: RemoteData<T, E>
): remoteData is NotAsked {
return remoteData.type === "NotAsked";
}
export function isLoading<T, E>(
remoteData: RemoteData<T, E>
): remoteData is Loading {
return remoteData.type === "Loading";
}
export function isSuccess<T, E>(
remoteData: RemoteData<T, E>
): remoteData is Success<T> {
return remoteData.type === "Success";
}
export function isFailure<T, E>(
remoteData: RemoteData<T, E>
): remoteData is Failure<E> {
return remoteData.type === "Failure";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment