Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/marker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export interface MarkerOptions {
* The marker for any middle (interior) points of a line segment. If the line
* segment only has a start and end point, this option has no effect. One of:
*
* - a marker name such as *arrow* or *circle*
* - a marker name such as *arrow* or *circle* (but not *arrow-reverse*,
* which only differs from *arrow* when used as **markerStart**)
* * *none* (default) - no marker
* * true - alias for *circle-fill*
* * false or null - alias for *none*
Expand All @@ -75,12 +76,13 @@ export interface MarkerOptions {
* *context* including the current document; they must return an SVG marker
* element.
*/
markerMid?: Marker | "none" | boolean | null;
markerMid?: Exclude<Marker, "arrow-reverse"> | "none" | boolean | null;

/**
* The marker for the ending point of a line segment; one of:
*
* - a marker name such as *arrow* or *circle*
* - a marker name such as *arrow* or *circle* (but not *arrow-reverse*,
* which only differs from *arrow* when used as **markerStart**)
* * *none* (default) - no marker
* * true - alias for *circle-fill*
* * false or null - alias for *none*
Expand All @@ -90,5 +92,5 @@ export interface MarkerOptions {
* *context* including the current document; they must return an SVG marker
* element.
*/
markerEnd?: Marker | "none" | boolean | null;
markerEnd?: Exclude<Marker, "arrow-reverse"> | "none" | boolean | null;
}
19 changes: 19 additions & 0 deletions test/marker.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */

import {it} from "vitest";
import * as Plot from "@observablehq/plot";

it("arrow-reverse is a valid marker and markerStart", () => {
Plot.link([], {marker: "arrow-reverse"});
Plot.link([], {markerStart: "arrow-reverse"});
Plot.line([], {marker: "arrow-reverse", markerEnd: "arrow"});
});

it("arrow-reverse is not a valid markerMid or markerEnd", () => {
// @ts-expect-error
Plot.link([], {markerMid: "arrow-reverse"});
// @ts-expect-error
Plot.link([], {markerEnd: "arrow-reverse"});
// @ts-expect-error
Plot.line([], {markerEnd: "arrow-reverse"});
});