since import * as R from 'fp-ts/lib/Record' ; import { These , left , right , both } from 'fp-ts/lib/These' ; import { identity } from 'fp-ts/lib/function' ; since export function alignWith < K extends string , P extends string , A , B , C > ( fa , fb , f ) ; export function alignWith < A , B , C > ( fa , fb , f ) ; export function alignWith < A , B , C > ( fa , fb , f ) { const r = { } ; for ( const key of Object . keys ( fa ) ) { if ( fb . hasOwnProperty ( key ) ) { r [ key ] = f ( both ( fa [ key ] , fb [ key ] ) ) ; } else { r [ key ] = f ( left ( fa [ key ] ) ) ; } } for ( const key of Object . keys ( fb ) ) { if ( ! fa . hasOwnProperty ( key ) ) { r [ key ] = f ( right ( fb [ key ] ) ) ; } } return r ; } since export function align < K extends string , P extends string , A , B > ( fa , fb ) ; export function align < A , B > ( fa , fb ) ; export function align < A , B > ( fa , fb ) { return alignWith < A , B , These < A , B > > ( fa , fb , identity ) ; } since export const nil = ( ) => R . empty ;