const recursionSymbol = Symbol ( 'recursion' ) ; const recursion = function ( parameters ) : Recursion { return { type : recursionSymbol , ... parameters } ; } ; interface Recursion { type : typeof recursionSymbol ; recursionPath : string ; } const isRecursion = function ( value ) : value is Recursion { return typeof value === 'object' && value !== null && 'type' in value && value . type === recursionSymbol ; } ; export type { Recursion } ; export { isRecursion , recursion } ;