I'm using the excellent Cleave.js library in my Typescript-based application. Cleave.js is used as follows:
import * as Cleave from 'cleave.js';
new Cleave(element).[whatever]
To aid in development, I'm developing typings for Cleave.js, however, I can't find an pattern in Typescript that allows me to specify the above construct.
When I use export class Cleave { ...} export default Cleave;
In the case above Typescript complains:
TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
When I import Cleave as import Cleave from 'cleave.js'
typescript attempts to find the default
field on the imported object which obviously does not exist.
How can write typings for new-able modules?