I defined the properties in my index.tsx like this:
interface Props {
uuid: string
cdn?: string
filename?: any
classname?: any
[key: string]: any
}
export const UCImage = ({
uuid,
cdn = 'https://ucarecdn.com/',
filename,
classname,
...props
}: Props) => {
// ...
}
And I add the component like this in my App.tsx:
const App = () => {
return (
<UCImage
uuid='83c3bad4-b4bc-4cea-8702-88ee61b0b015'
preview={{ width: 300, height: 300 }}
setFill={{ color: 'ff0000' }}
/>
)
}
Somehow I still get the error:
Type '{ uuid: string; preview: { width: number; height: number; }; setFill: { color: string; }; }' is missing the following properties from type 'Props': filename, classname
while the filename and classname are both optional parameters. Anyone with more experience in Typescript that can tell me why this doesn't work?