cleave.js icon indicating copy to clipboard operation
cleave.js copied to clipboard

Jest: TypeError: React.Component is not a constructor

Open superapplejuice opened this issue 4 years ago • 1 comments

I'm getting an error while running Jest with Cleave:

TypeError: React.Component is not a constructor`

      1 | import styled, { css } from 'styled-components'
    > 2 | import Cleave from 'cleave.js/react'
        | ^
      3 | import { isEmpty } from 'utils/array'
      4 | import { InputProps, ContainerProps, MessageProps } from './types'
      5 |

A different method I tried is to uninstall @types/cleave.js and create my own module like so:

declare module 'cleave.js/react' {
  const Cleave: any
  export default Cleave
}

However this did not work as well. I couldn't find a solution anywhere either so any help on this is greatly appreciated!

superapplejuice avatar Sep 15 '20 07:09 superapplejuice

Same here.

VldMrgnn avatar Sep 12 '21 14:09 VldMrgnn