Skip to content

Commit

Permalink
fix(scatterplot): adjust type/proptype of data[].id prop
Browse files Browse the repository at this point in the history
Close #943
  • Loading branch information
wyze committed Oct 2, 2020
1 parent 7d52c07 commit 71efd78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/scatterplot/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare module '@nivo/scatterplot' {
export type DerivedDatumProp<T> = (node: Datum) => T

export interface Serie {
id: string
id: string | number
data: Datum[]
}

Expand All @@ -48,6 +48,7 @@ declare module '@nivo/scatterplot' {
color: string
}
data: {
id: string | number
serieId: string
x: Value
formattedX: string | number
Expand Down
4 changes: 2 additions & 2 deletions packages/scatterplot/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Tooltip from './Tooltip'
const commonPropTypes = {
data: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
data: PropTypes.arrayOf(
PropTypes.shape({
x: PropTypes.oneOfType([
Expand Down Expand Up @@ -162,7 +162,7 @@ export const NodePropType = PropTypes.shape({
size: PropTypes.number.isRequired,
data: PropTypes.shape({
id: PropTypes.string.isRequired,
serieId: PropTypes.string.isRequired,
serieId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
x: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.instanceOf(Date)])
.isRequired,
formattedX: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
Expand Down

0 comments on commit 71efd78

Please sign in to comment.