Skip to content

Instantly share code, notes, and snippets.

@cinic
Created February 8, 2019 12:16
Show Gist options
  • Save cinic/8b6b50fcf45a4dd10d3b565bd4968834 to your computer and use it in GitHub Desktop.
Save cinic/8b6b50fcf45a4dd10d3b565bd4968834 to your computer and use it in GitHub Desktop.
Typings for Ramda pathOr method
declare module ramda {
declare type NestedMap<O: Object, P, T> = $Call<(
& (<A, B, C, D, E>([A, B, C, D, E]) => $ElementType<$ElementType<$ElementType<$ElementType<$ElementType<O, A>, B>, C>, D>, E>)
& (<A, B, C, D>([A, B, C, D]) => $ElementType<$ElementType<$ElementType<$ElementType<O, A>, B>, C>, D>)
& (<A, B, C>([A, B, C]) => $ElementType<$ElementType<$ElementType<O, A>, B>, C>)
& (<A, B>([A, B]) => $ElementType<$ElementType<O, A>, B>)
& (<A>([A]) => $ElementType<O, A>)
& (() => T)
), P>
declare function pathOr<O, P, T, A: $Keys<O>, B, C, D, E>(T, [A, B, C, D, E]): O => $ElementType<{ [E]: T, ...$Exact<NestedMap<O, [A, B, C, D], {}>> }, E>
declare function pathOr<O, P, T, A: $Keys<O>, B, C, D>(T, [A, B, C, D]): O => $ElementType<{ [D]: T, ...$Exact<NestedMap<O, [A, B, C], {}>> }, D>
declare function pathOr<O, P, T, A: $Keys<O>, B, C>(T, [A, B, C]): O => $ElementType<{ [C]: T, ...$Exact<NestedMap<O, [A, B], {}>> }, C>
declare function pathOr<O, P, T, A: $Keys<O>, B>(T, [A, B]): O => $ElementType<{ [B]: T, ...$Exact<NestedMap<O, [A], {}>> }, B>
declare function pathOr<O, P, T, A: $Keys<O>>(T, [A]): O => $ElementType<O, A>
declare function pathOr<O, P, T>(T, P): O => T
declare function pathOr<O, P, T, A: $Keys<O>, B, C, D, E>(T, [A, B, C, D, E], O): $ElementType<{ [E]: T, ...$Exact<NestedMap<O, [A, B, C, D], {}>> }, E>
declare function pathOr<O, P, T, A: $Keys<O>, B, C, D>(T, [A, B, C, D], O): $ElementType<{ [D]: T, ...$Exact<NestedMap<O, [A, B, C], {}>> }, D>
declare function pathOr<O, P, T, A: $Keys<O>, B, C>(T, [A, B, C], O): $ElementType<{ [C]: T, ...$Exact<NestedMap<O, [A, B], {}>> }, C>
declare function pathOr<O, P, T, A: $Keys<O>, B>(T, [A, B], O): $ElementType<{ [B]: T, ...$Exact<NestedMap<O, [A], {}>> }, B>
declare function pathOr<O, P, T, A: $Keys<O>>(T, [A], O): $ElementType<O, A>
declare function pathOr<O, P, T>(T, P, O): T
}
declare module 'ramda/src/pathOr' {
import typeof { pathOr } from 'ramda'
declare export default pathOr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment