Skip to content

Commit b94a3b5

Browse files
authored
Merge pull request #430 from Mitelak/main
Fix props types
2 parents 4c3b6b5 + 90b62a1 commit b94a3b5

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

packages/lib/src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ const defaultEmptyImage = {
9494
y: 0.5,
9595
}
9696

97-
type BorderType = [number, number] | number
98-
9997
interface ImageState {
10098
x: number
10199
y: number
@@ -109,7 +107,7 @@ export interface Props {
109107
height: number
110108
style?: CSSProperties
111109
image?: string | File
112-
border?: BorderType
110+
border?: number
113111
position?: Position
114112
scale?: number
115113
rotate?: number
@@ -128,6 +126,8 @@ export interface Props {
128126
disableHiDPIScaling?: boolean
129127
disableCanvasRotation?: boolean
130128
borderColor?: [number, number, number, number?]
129+
showGrid?: boolean
130+
gridColor?: string
131131
}
132132

133133
export interface Position {
@@ -142,8 +142,8 @@ interface State {
142142
image: ImageState
143143
}
144144

145-
type PropsWithDefaults = typeof AvatarEditor.defaultProps &
146-
Omit<Props, keyof typeof AvatarEditor.defaultProps>
145+
type PropsWithDefaults = Omit<Props, keyof typeof AvatarEditor.defaultProps> &
146+
Required<Pick<Props, keyof typeof AvatarEditor.defaultProps>>
147147

148148
class AvatarEditor extends React.Component<PropsWithDefaults, State> {
149149
private canvas = React.createRef<HTMLCanvasElement>()
@@ -165,7 +165,7 @@ class AvatarEditor extends React.Component<PropsWithDefaults, State> {
165165
disableBoundaryChecks: false,
166166
disableHiDPIScaling: false,
167167
disableCanvasRotation: true,
168-
}
168+
} satisfies Props
169169

170170
state: State = {
171171
drag: false,

0 commit comments

Comments
 (0)