Search code examples
reactjsreact-typescript

"This express is not callable. Type 'Boolean' has no call signatures"


I'm trying to create a React component using typescript but I got this error in my console "This expression is not callable. Type 'Boolean' has no call signatures."

Sandbox link for my code: https://codesandbox.io/s/cranky-carson-16lpe?file=/src/App.tsx

The error seems to be coming from line 17 for the 'setOpenPopup' props.

Not sure what I can do to correct the error. Would appreciate any help to troubleshoot. Thanks!


Solution

  • Your interface is wrong. By convention, setOpenPopup should be a function that takes a boolean and return any value most likely void

    interface PopupProps {
        openPopup: boolean;
        setOpenPopup: (open: boolean) => void;
    }