FERNman / angular-google-charts

A wrapper for the Google Charts library written in Angular.
Other
276 stars 107 forks source link

Expand Row interface definition #297

Closed oobayly closed 2 months ago

oobayly commented 1 year ago

Feature request

The interface definition for Row should also include the type {v: any, f: any} - see Cell Objects

Describe the solution you'd like

Update the Row interface

-export type Row = (string | number | Date | null)[];
+export type Row = (string | number | Date | { v: string | number | Date | null, f: string | null } | null)[];

I've added this into #296.

Describe alternatives you've considered

n/a

Additional context

n/a

kussmaul commented 1 year ago

Please add boolean as a valid data type, too.

FERNman commented 2 months ago

@kussmaul I've checked the google.visualization typings, they simply use any as the type. Probably they actually only allow primitives and Date (and no custom objects), but I'm not even sure about that.

Would you prefer sticking with the current typing (adding boolean to support all primitives), or simply switch to any to be more flexible? I'm leaning toward the latter. The resulting type would be

export type Row = (any | google.visualization.DataObjectCell)[];
kussmaul commented 2 months ago

@FERNman using any seems reasonable, especially since it matches google.visualization.

FERNman commented 2 months ago

@kussmaul great, then I'll go ahead and merge the PR! 👍