Which loader interface belongs to which geometry kind.
The loader interfaces are structurally distinct, so this mapping is
what keeps the kind-keyed store honest: register/loadersOf are generic in
K, so register('points', path, someLinesLoader) is a compile error rather
than a silent mis-route through the wrong update path.
Every GeometryKind must appear here. That is enforced — not merely
asked for — by AnyDataLoader indexing this type with the full
GeometryKind union: a kind added to contract.yaml without a loader entry
above fails to compile with TS2339: Property '<kind>' does not exist on type 'LoaderByKind' at that indexed access, plus TS2536 inside each generic
accessor below.
Note the enforcement can NOT be written as interface LoaderByKind extends Record<GeometryKind, …> — an interface inherits members it does not
redeclare, so a new kind would silently pick up the permissive base type
instead of erroring.
Which loader interface belongs to which geometry kind.
The loader interfaces are structurally distinct, so this mapping is what keeps the kind-keyed store honest:
register/loadersOfare generic inK, soregister('points', path, someLinesLoader)is a compile error rather than a silent mis-route through the wrong update path.Every GeometryKind must appear here. That is enforced — not merely asked for — by AnyDataLoader indexing this type with the full
GeometryKindunion: a kind added tocontract.yamlwithout a loader entry above fails to compile withTS2339: Property '<kind>' does not exist on type 'LoaderByKind'at that indexed access, plusTS2536inside each generic accessor below.Note the enforcement can NOT be written as
interface LoaderByKind extends Record<GeometryKind, …>— an interface inherits members it does not redeclare, so a new kind would silently pick up the permissive base type instead of erroring.