Why I get this error?
Argument of type 'string' is not assignable to parameter of type 'Pick<IJobs, "name">'. Type 'string' is not assignable to type 'Pick<IJobs, "name">'
mockData:
export const Jobs: IJobs[] = [ { id: '1', name: 'Trader', available: true }, { id: '2', name: 'Seller', available: true }, { id: '3', name: 'Manager', available: false }, { id: '4', name: 'Cleaner', available: false }];
Model:
export interface IJobs { id: string; name: 'Trader' | 'Seller' | 'Manager' | 'Cleaner'; available: boolean;}
Main.tsx
const handleSetJobsAndOpenModal = (jobs: Pick<IJobs, 'name'>) => { setCurrentJobs(jobs); }; const scrollData = useCallback(() => (<View style={s.containerMap}> { Jobs.map(((el) => (<Pressable onPress={() => handleSetJobsAndOpenModal(el.name)} style={s.Btn} key={el.id}><Text>...</Text></Pressable> ))) }</View> ), [])
The error comes at " () => handleSetJobsAndOpenModal(el.name) <-"
What I am doing wrong ?