Recipes

Type Your Track Requester

Give track.requester and track.userData a real shape with module augmentation.

By default track.requester and track.userData are loosely typed. Augment CustomizableTrack once and both become strongly typed everywhere a track flows.

Declare the shapes

augment-track.ts
.(..);
.(.?.);

One declaration, everywhere

The augmentation is global. Put it in a .d.ts (or any file that runs at startup) and every TrackStructure across your codebase picks up the types — no per-call casting.

Whatever you pass as requester is now checked against your shape.

pass-requester.ts
const  = await .({
  : 'never gonna give you up',
  : { : '123', : 'rick' },
});

.(.[0]?..);

Normalize with requesterFn

Set playerOptions.requesterFn to run every incoming requester through a mapper before it is stored — handy to strip a full Discord user down to just the fields you keep.

requester-fn.ts
const  = ({
  ,
  : [{ : 'localhost', : 2333, : 'youshallnotpass' }],
  : {
    : ,
  },
});