Skip to content

VocabularyLike

VocabularyLike<T> = IsVocabularyBag<T> extends true ? object & { [K in Exclude<keyof T, “inputs” | “events”>]: never } : InputMapLike<T>

Defined in: types.ts:400

The constraint on the curried factories’ map slot (#195, #183). The slot accepts either a bare input map, which is the 8.0 form unchanged, or a vocabulary bag with an inputs member, an events member, or both:

createFsm<MyInputs>()({ ... });                                 // input map
createFsm<{ events: MyEvents }>()({ ... });                     // events only
createFsm<{ inputs: MyInputs; events: MyEvents }>()({ ... });   // both
createBehavioralFsm<Connection, { events: MyEvents }>()({ ... });

The constraint is computed from the argument itself, so a malformed bag reports TS2344 on the type argument the same way a malformed input map does: an inputs member whose values are not tuples, a misspelled member name (alone or beside a valid member), an optional member, or an events member that reuses a built-in event name all fail here instead of degrading silently to the wide maps.

T