node-alea
node-alea copied to clipboard
Typescript error
Only a void function can be called with the 'new' keyword.
The typescript definition file appears to be invalid
As a workaround I am doing this:
import * as alea from 'alea';
interface PrngFactory {
new(seed?: string): () => number;
}
const Alea: PrngFactory = (alea as unknown) as PrngFactory;
let prng = new Alea('foo'); // no errors
you can just call Alea
as a normal function, i.e. just Alea('foo')
without the new
keyword