I want to desctruct react props that I pass to component with Typescript. These are my props:
export type IssueListHomeProps = {
projects: ProjectDtoImpl[];
issues: IssueDtoImpl[];
timeEntries: TimeEntryDtoImpl[];
handleRefresh: () => void;
changeMode: (m: string) => void;
selectTimeEntry: (entry: TimeEntryDtoImpl) => void;
pullToRefresh: boolean;
dates: string[];
} & RouteComponentProps;
That's how I'm trying to do this:
const {projects: ProjectDtoImpl[], issues: IssueDtoImpl[],timeEntries: TimeEntryDtoImpl[],pullToRefresh: boolean, dates: string[]} = this.props
But I get errors like these:
1.Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
2.Expression expected
I don't know where to do this: in component or outside, or may be in the constructor? Thanks in Advance!!
const {projects, issues, timeEntries, pullToRefresh, dates} = this.props