import { extractInfoFromServerReferenceId } from '../shared/lib/server-reference-info' // Only contains the properties we're interested in. export interface ServerReference { $$typeof: Symbol $$id: string } export type ServerFunction = ServerReference & ((...args: unknown[]) => Promise) export function isServerReference( value: T & Partial ): value is T & ServerFunction { return value.$$typeof === Symbol.for('react.server.reference') } export function isUseCacheFunction( value: T & Partial ): value is T & ServerFunction { if (!isServerReference(value)) { return false } const { type } = extractInfoFromServerReferenceId(value.$$id) return type === 'use-cache' } export function isClientReference(mod: any): boolean { const defaultExport = mod?.default || mod return defaultExport?.$$typeof === Symbol.for('react.client.reference') }