import * as React from "react" ; function isUpdater < T > ( argument ) { return typeof argument === "function" ; } example export function applyState < T > ( argument , currentValue ) { if ( isUpdater ( argument ) ) { return argument ( currentValue ) ; } return argument ; }