UNPKG

@spark-web/utils

Version:

--- title: Utilities isExperimentalPackage: true ---

16 lines (15 loc) 792 B
import type { MutableRefObject } from 'react'; /** * React.Ref uses the readonly type `React.RefObject` instead of * `React.MutableRefObject`, We pretty much always assume ref objects are * mutable (at least when we create them), so this type is a workaround so some * of the weird mechanics of using refs with TS. */ export declare type AssignableRef<ValueType> = { bivarianceHack(instance: ValueType | null): void; }['bivarianceHack'] | MutableRefObject<ValueType | null>; /** * Type can be either a single `ValueType` or an array of `ValueType` */ export declare type SingleOrArray<ValueType> = ValueType[] | ValueType; export declare type ElementTagNameMap = HTMLElementTagNameMap & Pick<SVGElementTagNameMap, Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>>;