반응형
React + TypeScript 오류:이 호출과 일치하는 오버로드가 없습니다.
다음과 같은 배열을 통해 매핑할 때 큰 오류가 발생합니다.
// 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;
오류:
이 통화와 일치하는 과부하가 없습니다.오버로드 1/2, '(props: 읽기 전용):TestRow', 다음 오류가 발생했습니다.
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
오류 메시지에서 문제를 찾을 수 있습니다. Property 'handleTextAreaUpdate' does not exist on type다음에 대한 속성을 정의해야 함을 의미합니다.handleTextAreaUpdate에서TestRowProps인터페이스
당신은 아마도 그것을 놓치고 있을 것입니다.return함수 내부에 있습니다.저도 같은 문제가 있었지만 내보내기 기능이 없다는 것을 깨달았습니다.return.
언급URL : https://stackoverflow.com/questions/58449813/react-typescript-error-no-overload-matches-this-call
반응형
'programing' 카테고리의 다른 글
| 컴파일러가 프로그램의 시간 복잡성을 저하시키는 것이 합법입니까?이것이 관찰 가능한 행동으로 간주됩니까? (0) | 2023.07.09 |
|---|---|
| 데이터 프레임 열을 숫자 형식으로 변환하는 방법은 무엇입니까? (0) | 2023.07.09 |
| MariaDB에서 트리거 starts에 배치된 함수는 다른 값을 반환합니다. (0) | 2023.07.09 |
| FutureWarning: 저장이 Python의 공용 API의 일부가 아닙니다. (0) | 2023.07.09 |
| 오라클 저장 프로시저를 어떻게 인쇄합니까(디버깅 목적)? (0) | 2023.07.09 |