import { isPlainObject } from "./isPlainObject" ; deprecated example function __deprecatedSplitProps < T extends Record < string , any > , K extends keyof T > ( props , keys ) { const propsKeys = Object . keys ( props ) ; const picked = { } as { [ P in K ] : T [ P ] ; } ; const omitted = { } as Omit < T , K > ; for ( const key of propsKeys ) { if ( keys . indexOf ( key as K ) >= 0 ) { picked [ key as K ] = props [ key ] ; } else { omitted [ key as Exclude < keyof T , K > ] = props [ key ] ; } } return [ picked , omitted ] ; } example example export function splitProps < T extends Record < string , any > , K extends keyof T > ( props , keys = [ ] ) { if ( ! isPlainObject ( props . state ) ) { return __deprecatedSplitProps ( props , keys ) ; } const [ picked , omitted ] = __deprecatedSplitProps ( props , [ ... keys , "state" ] ) ; const { state , ... restPicked } = picked ; return [ { ... state , ... restPicked } , omitted as Omit < T , K > ] ; }