Hoshimi
Guides

Tracks and Resolution

Work with Track and UnresolvedTrack safely using type guards.

This page explains how to handle resolved and unresolved tracks in queue and playback flows. Use it to keep runtime checks explicit when working with mixed track inputs.

Type reference: Core API (TypeDoc)

Quick links:

Narrow Track Types

track-guards.ts
import { ,  } from 'hoshimi';
import type { ,  } from 'hoshimi';

declare const :  | ;

if (()) {
  .(..);
}

if (()) {
  .(..);
}

Queue With Mixed Inputs

queue-mixed-tracks.ts
import type { , ,  } from 'hoshimi';

declare const : ;
declare const : < | >;

for (const  of ) {
  await ..();
}

if (!.()) {
  await .();
}

Notes

  • Prefer isResolved() before relying on encoded identifiers.
  • Keep unresolved tracks minimal and let node search resolve final metadata.
  • Store requester/userData consistently when creating tracks manually.

On this page