Invalid `floor` invocation from `isTimeInterval`
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 85/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- javascript, typescript
- Domain
- data-visualization
Research direction
Start with the floor call in src/options.js and compare it with the floor signature in src/interval.d.ts. Update the type contract to reflect the no-argument invocation, then verify that the declaration matches the documented binning behavior and type checking succeeds.
Written by the indexing model from the issue text.
Description
Somewhere during binning of temporal data this function is executed:
Notice that no argument is passed to floor when the function tries to figure out if the result type is a Date.
This is in conflict with the type definitions, which indicate that a parameter to floor is guaranteed:
I believe the simplest fix would be
- */
- floor(value: T): T
+ *
+ * If no value is passed, the function is expected to return *any* result
+ * matching its return type.
+ */
+ floor(value?: T): T
Related: #2423
Edit: I just noted that this behaviour is documented on the Bin transform page (but not the Interval transform), which increases my confidence that it’s really just the type that’s off.
Time intervals are intervals that are also functions that return a Date instance when called with no arguments.
- Dominant language
- HTML
- Stars
- 5.4k
- Forks
- 244
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from observablehq/plot
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
observablehq/plot#2459 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
observablehq/plot#2453 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
observablehq/plot#2451 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
observablehq/plot#1533 · 3 comments · 1 reaction ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
observablehq/plot#811 · 1 comment ·
All issues in observablehq/plot
Similar issues
-
Urgent request: Due to vulnerabilities move to API version 12.6.1 (12.6.2 eventually) or 13.1.1 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
jbkunst/highcharter#849 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AOSSIE-Org/OrgExplorer#245 · 1 assignee ·
-
tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
gordonwatts/test-wsl2-llm#151 ·