Skip to content

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Nov 3, 2023

This fixes a TypeScript type inference bug in a case like this:

Plot.plot({
  marks: [
    Plot.differenceY(
      stocks,
      Plot.normalizeY(
        Plot.groupX(
          {y1: Plot.find((d) => d.Symbol === "GOOG"), y2: Plot.find((d) => d.Symbol === "AAPL")},
          {x: "Date", y: "Close", curve: "cardinal", tension: 0.1}
        )
      )
    )
  ]
})

Previously, TypeScript would assume that the normalizeY transform was being passed a single argument of basis; now it correctly assumes that it is being passed a single argument of options.

@mbostock mbostock requested a review from Fil November 3, 2023 16:00
@mbostock mbostock mentioned this pull request Nov 3, 2023
9 tasks
@Fil
Copy link
Contributor

Fil commented Nov 6, 2023

Confirmed (both error and fix) with areaY.

@mbostock mbostock merged commit 4cf4d73 into main Nov 7, 2023
@mbostock mbostock deleted the mbostock/fix-option-overload-type branch November 7, 2023 17:12
chaichontat pushed a commit to chaichontat/plot that referenced this pull request Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants