14
votes

I am receiving a massive error when mapping through an array like:

// Home.tsx

  render() {
    const { inputs, outputs, expectedOutputs } = this.state;
    return (
        <ContentContainer>
          {inputs.map((input, i) => {
            return (
              <TestRow
                key={i}
                rowNumber={i}
                xml={inputs[i].xml}
                desc={inputs[i].desc}
                output={outputs[i]}
                expectedOutput={expectedOutputs[i]}
                handleTextAreaUpdate={this.handleTextAreaUpdate}
              />
            );
          })}
        </ContentContainer>
    );
// TestRow.tsx

interface TestRowProps {
  xml: string;
  desc: string;
  output: string;
  expectedOutput: string;
  rowNumber: number;
}

class TestRow extends Component<TestRowProps, {}> {
  textArea: any;

the error is:

No overload matches this call. Overload 1 of 2, '(props: Readonly): TestRow', gave the following error.

    Type '{ key: number; rowNumber: number; xml: string; desc: string; output: never; expectedOutput: string; handleTextAreaUpdate: (e: { target: { value: string; }; }, column: number, rowNumber: number) => void; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<TestRow> & Readonly<TestRowProps> & Readonly<{ children?: ReactNode; }>'.
      Property 'handleTextAreaUpdate' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<TestRow> & Readonly<TestRowProps> & Readonly<{ children?: ReactNode; }>'.
  Overload 2 of 2, '(props: TestRowProps, context?: any): TestRow', gave the following error.
    Type '{ key: number; rowNumber: number; xml: string; desc: string; output: never; expectedOutput: string; handleTextAreaUpdate: (e: { target: { value: string; }; }, column: number, rowNumber: number) => void; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<TestRow> & Readonly<TestRowProps> & Readonly<{ children?: ReactNode; }>'.
      Property 'handleTextAreaUpdate' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<TestRow> & Readonly<DiagramProps> & Readonly<{ children?: ReactNode; }>'

. TS2769

1
Property 'handleTextAreaUpdate' does not exist on type means that your component TestRow does not expect a prop called handleTextareaUpdateyadejo
Please provide implementation of TestRow. It seems that it doesn't have any props at all.Fyodor
updated to include interfacePetar Ivcec
@yadejo do i need to add that prop to interface?Petar Ivcec
It seems handleTextAreaUpdate does not exist on whatever the render function is attached to.jperl

1 Answers

13
votes

in the error message, you can find the problem. Property 'handleTextAreaUpdate' does not exist on type means that you should define a property for handleTextAreaUpdate in the TestRowProps interface.