isInstructionPlan

function isInstructionPlan(value): value is InstructionPlan;

Checks if the given value is an InstructionPlan.

This type guard checks the planType property to determine if the value is an instruction plan. This is useful when you have a value that could be an InstructionPlan, TransactionPlan, or TransactionPlanResult and need to narrow the type.

Parameters

ParameterTypeDescription
valueunknownThe value to check.

Returns

value is InstructionPlan

true if the value is an instruction plan, false otherwise.

Example

function processItem(item: InstructionPlan | TransactionPlan | TransactionPlanResult) {
  if (isInstructionPlan(item)) {
    // item is narrowed to InstructionPlan
    console.log(item.kind);
  }
}

See

On this page