I am using React, TypeScript and Redux. I seem to have an issue with using an interface for one of my actions. The cryptic message I am getting is:
Duplicate identifier 'number'.ts(2300)
Binding element 'number' implicitly has an 'any' type.ts(7031)
And in VS code the number both on limit: and skip: is underlined with a red error squiggly line.
Snipped of my code:
interface TabNavUnitsProps {
unitsToRegister: number,
unit: { status: string, unitsRegisterCount: number },
fetchRegisterAll: ({ limit: number, skip: number }) => Promise<void>
}
export class TabNavUnits extends React.Component<TabNavUnitsProps> {
state = {
unitsRegisterCount: 0
}
componentDidMount() {
this.props.fetchRegisterAll({ limit: 1, skip: 1 })
.then(() => {
if(this.props.unit.status === fetchStates.success) {
this.setState({ unitsRegisterCount: this.props.unit.unitsRegisterCount })
}
})
}
I admit part of the problem is I am new to this so thank you to anyone who is willing to help or point me in the right direction.
CodePudding user response:
Just declare fetchRegisterAll
correctly:
fetchRegisterAll: (options: { limit:number , skip: number }) => Promise<void>