Skip to main content
Type guard that checks whether a value is a CallData instance. Provides TypeScript type narrowing.

Signature

Parameters

  • value - Value to check (any type)

Returns

boolean - true if value is CallData instance (with type narrowing)

Examples

Type Narrowing

TypeScript narrows the type when is() returns true:

Comparison with isValid

Checks: Already constructed CallData instance Returns: Type guard (value is CallDataType) Use for: Type narrowing, checking existing instances

Use Cases

Function Overloads

Union Type Handling

Generic Functions

Type-Safe Caching

Implementation

Checks for CallData brand:
Checks:
  1. Is Uint8Array
  2. Has CallData brand
  3. Minimum 4 bytes (selector)

Performance

Very fast (just property checks):

Type Safety Example

Branded Type Pattern

CallData uses Symbol branding for type safety:
This prevents accidental mixing of Uint8Arrays with CallData.