Skip to content

Commit

Permalink
fix: make DataGroup compatible with TimelineGroup (#149)
Browse files Browse the repository at this point in the history
Currently TimelineGroup[] cannot be used in the constructor for Timeline nor the setData method.

`TimelineGroup.content` is of type `string | HTMLElement` which is currently not assignable to `DataGroupCollectionType.content`. However the docs say a group can contain an `HTMLElement`.

A Timeline Group's `subgroupOrder` function accepts a string or a sort function. The `TimelineGroup`'s function (which is a sort function) does not match the `DataGroup`'s function. `DataGroup`'s function was changed to be a sort function like `TimelineGroup`.

Now a TimelineGroup[] can be used in the constructor to make a Timeline.

The other option would be to set `Timeline`'s constructor to TimelineGroup instead of DataGroup and all methods as well.
  • Loading branch information
EricKit authored and yotamberk committed Oct 21, 2019
1 parent 9d043d4 commit 61877cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ export interface SubGroupVisibilityOptions {

export interface DataGroup {
className?: string;
content: string;
content: string | HTMLElement;
id: IdType;
options?: DataGroupOptions;
style?: string;
subgroupOrder?: string | (() => void);
subgroupOrder?: string | ((a: any, b: any) => number);
title?: string;
nestedGroups?: IdType[];
subgroupStack?: SubGroupStackOptions | boolean;
Expand Down

0 comments on commit 61877cc

Please sign in to comment.