🤹🏻‍♀️ Javascript/🥎 Typescript

타입스크립트 에러

ji-hyun 2022. 2. 25. 15:48

https://stackoverflow.com/questions/68285637/got-type-void-is-not-assignable-to-type-void-in-react-typescript

 

got Type 'void' is not assignable to type '() => void' in react typescript

I tried to pass the props like <Mycomp deleteAcc={handleDelete(accountId)} /> to another component. I write the props like interface AccProps { deleteAcc: () => void; } and call the fu...

stackoverflow.com

 

 

 

 

 

container

 

 const handlePage = (page: number): void => {
    setPage(page - 1);
    // NOTE : 새로운 페이지 데이터 로딩
    getGifticons({
      variables: { skip: page * 10, take: 10 },
    });
    
    return (
    <Presenter
      page={page}
      handlePage={() => handlePage(page)}
      tableData={tableData(listData)}
    />
  );
    
  };

 

 

 

 

 

 

 

Type

 

export interface PropType {
  page: number;
  handlePage: (page: number) => void;
  tableData: tableData;
}

 

 

 

 

'🤹🏻‍♀️ Javascript > 🥎 Typescript' 카테고리의 다른 글

[TS] 조건부 타입  (0) 2022.05.07
[TS] 제네릭  (0) 2022.05.07
타입 추론, 타입 단언  (0) 2022.03.06
체크박스 typescript (useState Type)  (0) 2022.02.25
material ui - Pagination  (0) 2022.02.25