PitchKit
API Reference@pitchkit/data-providersstatsbombFunctions

parseEvents()

function parseEvents(json): StatsBombEvent[];

Defined in: packages/data-providers/src/statsbomb/parse.ts:68

Parse a match's events file.

Every event is returned as StatsBomb wrote it, spread rather than rebuilt — so fields this package doesn't model (and ones StatsBomb adds later) survive untouched. The only additions are the lifted coordinates: x/y from location, and endX/endY/endZ from the end_location of a shot, pass or carry.

Narrowing the returned union goes through the guards — shots(events), isShot(event) — not through event.type.name === "Shot". TypeScript only narrows on top-level literal discriminants, and StatsBomb's discriminant is nested one level down inside type, so a hand-rolled comparison runs correctly but fails to typecheck.

Parameters

ParameterType
jsonunknown

Returns

StatsBombEvent[]

On this page