[TypeScript Error] Parameter 'props' implicitly has an 'any' type.

고병표·2022년 2월 13일
0

Error 모음

목록 보기
6/13
post-thumbnail

🤔 Parameter 'props' implicitly has an 'any' type.

props가 암묵적으로 'any' 타입으로 지정되어 있다는 경고!

보통 부모로부터 받는 props의 타입이 명시가 되어있지 않을 때 많이 발생한다

🔥 How to fix ?

  • 확인사항!

interface Props {}

interface State {}

export default class App extends React.Component<Props, State> {

constructor(props : Props) {super(props);}}

  • ex) 예시
class MyComponent extends React.Component<any, any> {

    constructor(props: any) {
        super(props);
    }
}

any 타입은 최대한 안쓰기!

0개의 댓글