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.
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) fromCHART_TYPES
. That would prevent typos but it would require a way to extend that union to support arbitrary visualization types (similarly toHTMLElementTagNameMap
). 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 useDataObjectColumn
rows: unknown[][]|undefined
could be useDataObjectRow
All those changes are likely to be breaking. We should weight the benefits they offer.