A declaration of what one series means, discriminated on its type.
type is the TraceType string value, not a private alias: the word
the author writes is the word emitted in MaidrLayer.type and printed in
every warning. Two of them surprise people and are called out on the fields
that carry them — TraceType.SCATTER is 'point' and TraceType.PARALLEL
is 'parallel_coordinates'.
The key set of each variant is closed, and adapters check it at read
time — the key names, the shape of each value, and the presence of the few
fields a variant cannot be read without. A plain-JS author who writes
significanse: 7.3, or significanceDirection: 'Below', is told so, which
is the only defence available outside TypeScript. A value that is not what
its key takes is dropped rather than passed on, so the grammar's own default
applies instead of a wrong reading.
A declaration of what one series means, discriminated on its
type.typeis theTraceTypestring value, not a private alias: the word the author writes is the word emitted inMaidrLayer.typeand printed in every warning. Two of them surprise people and are called out on the fields that carry them —TraceType.SCATTERis'point'andTraceType.PARALLELis'parallel_coordinates'.The key set of each variant is closed, and adapters check it at read time — the key names, the shape of each value, and the presence of the few fields a variant cannot be read without. A plain-JS author who writes
significanse: 7.3, orsignificanceDirection: 'Below', is told so, which is the only defence available outside TypeScript. A value that is not what its key takes is dropped rather than passed on, so the grammar's own default applies instead of a wrong reading.