import {is, setHidden} from '../utils' import {SynthedNode} from './SynthedNode' import {SynthedNodes} from './SynthedNodes' const $node: any = Symbol.for('Synthed:node') export const isSynthed = (value: any): value is Synthed => !!value && value[$node] === value export const getSynthed = (owner: any): Synthed | undefined => owner && owner[$node] export const setSynthed = (owner: any, node: Synthed) => setHidden(owner, $node, node) export const getSynthedType = (value: any) => { const parentNode = getSynthed(value) return parentNode ? (parentNode.constructor as any) : is.arr(value) || is.obj(value) ? SynthedNodes : SynthedNode } export abstract class Synthed { abstract get (synthed?: boolean): T | undefined abstract set (...tags: any[]): this abstract reset (goal?: any): this }