import { observable as reactiveObservable } from '@goldfishjs/reactive' ; import checkSetupEnv from './checkSetupEnv' ; const valueFlag = { } ; export function isValue ( val ) { return val && typeof val === 'object' && val . __type__ === valueFlag ; } type PrimaryType = number | boolean | null | undefined | string ; export default function useValue < T extends PrimaryType > ( val ) { checkSetupEnv ( 'useValue' , [ 'app' , 'component' , 'page' ] ) ; const obj = { value : val } ; Object . defineProperty ( obj , '__type__' , { enumerable : false , configurable : false , writable : false , value : valueFlag , } ) ; return reactiveObservable ( obj ) as { value : T ; } ; }