import type { ArgsWrapper , Thunk } from './types' ; export const DEFAULT_THUNK = ( ) => [ ] ; export function normalizeThunk ( thunk ) { let args = thunk ( ) ; if ( Array . isArray ( args ) ) { return { named : { } , positional : args } ; } if ( ! args ) { return { named : { } , positional : [ ] } ; } /**
     * Hopefully people aren't using args named "named"
     */ if ( 'positional' in args || 'named' in args ) { return args ; } return { named : args as Record < string , unknown > , positional : [ ] } ; } export function proxyClass < Instance extends object > ( target ) { return new Proxy ( target , { get ( target , key ) { const instance = target . value ; const value = Reflect . get ( instance as object , key , instance ) ; return typeof value === 'function' ? value . bind ( instance ) : value ; } , ownKeys ( target ) { return Reflect . ownKeys ( target . value ) ; } , getOwnPropertyDescriptor ( target , key ) { return Reflect . getOwnPropertyDescriptor ( target . value , key ) ; } , } ) as never as Instance ; }