Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Typescript cryptic message when declaring function for one of my actions

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

>Solution :

Just declare fetchRegisterAll correctly:

  fetchRegisterAll: (options: { limit:number , skip: number }) => Promise<void>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading