Skip to content

Commit

Permalink
feat(pie): fix typings
Browse files Browse the repository at this point in the history
  • Loading branch information
plouc committed Nov 20, 2023
1 parent 238e8d1 commit a1a774d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/pie/src/PieCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ const InnerPieCanvas = <RawDatum extends MayHaveLabel>({
centerY,
arcGenerator,
dataWithArc,
borderWidth,
getBorderColor,
enableArcLabels,
arcLabels,
Expand Down
2 changes: 1 addition & 1 deletion packages/pie/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export const usePieFromBox = <RawDatum>({
innerRadius,
debug: boundingBox,
}
}, [width, height, innerRadiusRatio, startAngle, endAngle, fit, cornerRadius])
}, [width, height, innerRadiusRatio, startAngle, endAngle, fit])

const pieArcs = usePieArcs({
data,
Expand Down
2 changes: 1 addition & 1 deletion packages/pie/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface DefaultRawDatum {
value: number
}

export interface MayHaveLabel {
export interface MayHaveLabel extends Object {
label?: string | number
}

Expand Down
8 changes: 7 additions & 1 deletion packages/pie/tests/Pie.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ import { LegendSvgItem, SymbolSquare } from '@nivo/legends'
// @ts-ignore
import { Pie } from '../src/index'

const sampleData = [
interface SampleDatum {
id: string
value: number
color: string
}

const sampleData: readonly SampleDatum[] = [
{
id: 'A',
value: 30,
Expand Down

0 comments on commit a1a774d

Please sign in to comment.