Skip to content

Commit

Permalink
fix(type): align grid api with option interface
Browse files Browse the repository at this point in the history
Ref #3037
  • Loading branch information
netil authored Jan 20, 2023
1 parent 39a0fd0 commit b89b74a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
16 changes: 3 additions & 13 deletions types/chart.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2017 ~ present NAVER Corp.
* billboard.js project is licensed under the MIT license
*/
import {Data} from "./options";
import {Data, RegionOptions} from "./options";
import {ArrayOrString, d3Selection, DataArray, DataItem, PrimitiveArray, TargetIds} from "./types";

export interface Chart {
Expand Down Expand Up @@ -102,23 +102,13 @@ export interface Chart {
* Update regions.
* @param regions Regions will be replaced with this argument. The format of this argument is the same as regions.
*/
(regions: Array<{
axis: "x" | "y" | "y2",
start?: number | Date,
end?: number | Date,
class?: string
}>): void;
(regions: RegionOptions[]): void;

/**
* Add new region. This API adds new region instead of replacing like regions.
* @param grids New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added.
*/
add<T = {
axis: "x" | "y" | "y2",
start?: number | Date,
end?: number | Date,
class?: string
}>(regions: T | T[]): void;
add(regions: RegionOptions | RegionOptions[]): void;

/**
* Remove regions. This API removes regions.
Expand Down
2 changes: 1 addition & 1 deletion types/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export interface ChartOptions {
}

export interface RegionOptions {
axis?: string;
axis?: "x" | "y" | "y2";
start?: string | number | Date;
end?: string | number | Date;
class?: string;
Expand Down

0 comments on commit b89b74a

Please sign in to comment.