import * as React from 'react'; export function fillRef(ref: React.Ref, node: T) { if (typeof ref === 'function') { ref(node); } else if (typeof ref === 'object' && ref && 'current' in ref) { (ref as any).current = node; } } export function composeRef(...refs: React.Ref[]): React.Ref { return (node: T) => { refs.forEach(ref => { fillRef(ref, node); }); }; }