nick-keller / react-datasheet-grid

An Airtable-like / Excel-like component to create beautiful spreadsheets.
MIT License
1.77k stars 167 forks source link

No type support for custom cell components that are created with React.memo #240

Open seriojca opened 1 year ago

nick-keller commented 1 year ago

Hey @seriojca , can you please be more explicit?

seriojca commented 1 year ago

I receive the following : NamedExoticComponent<CellProps<any, any>>' is not assignable to type 'CellComponent<any, any> when i place a React.memo in component attribute and have to write it component: Component as any for it to be working, if that makes sense.

nick-keller commented 1 year ago

Can you share some code to demonstrate what is wrong ?

seriojca commented 1 year ago

...keyColumn<any, 'id'>('id', { component: ExampleMemoComponent as any, columnData: 'id' }),

i have to make ExampleMemoComponent as any, otherwise it will give me errors

l0g1x commented 1 year ago

I have the same issue. if I simply try to reproduce the example here: https://react-datasheet-grid.netlify.app/docs/examples/implementing-select#final-result

I get a type error image

But if I change the SelectComponent type to any (as mentioned by @seriojca above) then it no longer complains: image

Dennis-N8 commented 1 year ago

This approach worked for me.

https://stackoverflow.com/a/60170425