cleave.js
cleave.js copied to clipboard
Jest: TypeError: React.Component is not a constructor
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!
Same here.