import type { PropTypeConfig , PropTypeConfig_Compound , PropTypeConfig_Enum , } from '@theatre/core/propTypes' ; import type { PathToProp } from '@theatre/shared/utils/addresses' ; import type { $IntentionalAny } from '@theatre/shared/utils/types' ; export function isPropConfigComposite ( c ) { return c . type === 'compound' || c . type === 'enum' ; } export function getPropConfigByPath ( parentConf , path ) { if ( ! parentConf ) return undefined ; const [ key , ... rest ] = path ; if ( typeof key === 'undefined' ) return parentConf ; if ( ! isPropConfigComposite ( parentConf ) ) return undefined ; const sub = parentConf . type === 'enum' ? parentConf . cases [ key ] : ( parentConf as $IntentionalAny ) . props [ key ] ; return getPropConfigByPath ( sub , rest ) ; }