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
.(..);
.(.?.);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.
Pass it through search
Whatever you pass as requester is now checked against your shape.
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.
const = ({
,
: [{ : 'localhost', : 2333, : 'youshallnotpass' }],
: {
: ,
},
});