Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeScript - type definition for extended standard lib Math

I want to use the javascript library

seedrandom.js

in a TypeScript project yet can't figure out how to write a type definition for this lib which extends the standard javascript Math library with an additional method:

Math.seedrandom();
like image 727
dorjeduck Avatar asked Sep 15 '25 20:09

dorjeduck


1 Answers

Just add to the Math interface

interface Math {
    seedrandom(seed?: string);
}

Math.seedrandom();
like image 55
basarat Avatar answered Sep 18 '25 10:09

basarat