I'm trying to run Fluent UI Basic List example on my own bench. The example is presented here: https://developer.microsoft.com/en-us/fluentui#/controls/web/list. I copied entire example's code to app and replaced example's data with my own array. However I'm getting following error:
Type '(item: IExampleItem, index: number | undefined) => JSX.Element' is not assignable to type
'(item?: { key: number; name: string; } | undefined, index?: number | undefined, isScrolling?:
boolean | undefined) => ReactNode'.`
Types of parameters 'item' and 'item' are incompatible.
Type '{ key: number; name: string; } | undefined' is not assignable to type 'IExampleItem'.
Type 'undefined' is not assignable to type 'IExampleItem'. TS2322
83 |
84 |
85 | <List items={data} onRenderCell={onRenderCell} />
| ^
86 |
87 | );
88 | };
Is it because this is a Typescript file? Should I disable something to change compilation and prevent such errors?
My code after changes looks as follows: https://codepen.io/vipperdev/pen/QWNdeJe