isBinding

See source code

Type guard to check if a record is a TLBinding. Useful for filtering or type narrowing when working with mixed record types.

function isBinding(record?: UnknownRecord): record is TLBinding;

Example

// Filter bindings from mixed records
const allRecords = store.allRecords();
const bindings = allRecords.filter(isBinding);

// Type guard usage
function processRecord(record: UnknownRecord) {
  if (isBinding(record)) {
    // record is now typed as TLBinding
    console.log(`Binding from ${record.fromId} to ${record.toId}`);
  }
}

Parameters

NameDescription

record

The record to check

Returns

record is TLBinding;

True if the record is a binding, false otherwise

Prev
idValidator
Next
isBindingId