google-chart icon indicating copy to clipboard operation
google-chart copied to clipboard

Stricter typings

Open rslawik opened this issue 4 years ago • 0 comments

Should we introduce stricter types for some of the properties of GoogleChart?

  • type: string could be replaced with the union of all keys (string literals) from CHART_TYPES. That would prevent typos but it would require a way to extend that union to support arbitrary visualization types (similarly to HTMLElementTagNameMap). Suggested by @rictic.

  • options: {}|undefined could be replaced with the union of all known options types from DefinitelyTyped google.visualization. For example: LineChartOptions|ColumnChartOptions.

  • cols: unknown[]|undeifned could be use DataObjectColumn

  • rows: unknown[][]|undefined could be use DataObjectRow

All those changes are likely to be breaking. We should weight the benefits they offer.

rslawik avatar Apr 26 '20 12:04 rslawik