i made a clicker game in phaser 3 typescript. game based on clicker heroes decompiled flash game sources. convert this class into typescript:

package com.playsaurus.numbers
{
   public class BigNumber
   {
       
      
      public var base:Number;
      
      public var power:Number;
      
      public function BigNumber(param1:Object = 0, param2:int = 0, param3:int = -1)
      {
         super();
         if(param1 is Number)
         {
            if(param1 == 0)
            {
               this.base = 0;
               this.power = 0;
            }
            else
            {
               this.fromFloat(param1 as Number);
            }
         }
         else if(param1 is String)
         {
            this.fromString(param1 as String);
         }
         else if(param1 is BigNumber)
         {
            this.base = (param1 as BigNumber).base;
            this.power = (param1 as BigNumber).power;
         }
         else
         {
            this.base = 0;
            this.power = 0;
         }
      }
      
      public static function copy(param1:BigNumber) : BigNumber
      {
         var _loc2_:BigNumber = new BigNumber(0);
         _loc2_.base = param1.base;
         _loc2_.power = param1.power;
         return _loc2_;
      }
      
      public static function clone(param1:BigNumber) : BigNumber
      {
         return BigNumber.copy(param1);
      }
      
      public static function max(param1:BigNumber, param2:BigNumber) : BigNumber
      {
         if(param1.gte(param2))
         {
            return param1;
         }
         return param2;
      }
      
      public static function min(param1:BigNumber, param2:BigNumber) : BigNumber
      {
         if(param1.lte(param2))
         {
            return param1;
         }
         return param2;
      }
      
      public function fromString(param1:String) : void
      {
         var _loc2_:Array = param1.split("e");
         this.base = Number(_loc2_[0]);
         _loc2_.splice(0,1);
         this.power = Number(_loc2_.join("e"));
         this.normalize();
      }
      
      public function toFixed(param1:int = 2) : String
      {
         var _loc2_:String = null;
         var _loc4_:* = null;
         var _loc6_:int = 0;
         var _loc3_:Array = this.toString().split("e");
         var _loc5_:Array;
         if((_loc5_ = _loc3_[0].split("."))[1])
         {
            if(_loc5_[1].length < param1)
            {
               _loc6_ = int(_loc5_[1].length);
               while(_loc6_ < param1)
               {
                  _loc5_[1] += "0";
                  _loc6_++;
               }
            }
            else
            {
               _loc5_[1] = _loc5_[1].substr(0,param1);
            }
         }
         if(_loc3_[1])
         {
            _loc3_[0] = !!_loc5_[1] ? _loc5_.join(".") : _loc5_[0];
            _loc2_ = _loc3_.join("e");
         }
         else
         {
            _loc2_ = !!_loc5_[1] ? _loc5_.join(".") : String(_loc5_[0]);
         }
         return _loc2_;
      }
      
      public function toString() : String
      {
         var _loc3_:Number = NaN;
         var _loc1_:Number = this.base;
         var _loc2_:Number = this.power;
         if(_loc2_ < 5 && _loc2_ >= 0)
         {
            while(_loc2_ > 0)
            {
               _loc1_ *= 10;
               _loc2_--;
            }
            _loc3_ = _loc1_;
            this.normalize();
            return _loc3_.toString();
         }
         if(_loc2_ > -5 && _loc2_ < 0)
         {
            while(_loc2_ < 0)
            {
               _loc1_ /= 10;
               _loc2_++;
            }
            _loc3_ = _loc1_;
            this.normalize();
            return _loc3_.toString();
         }
         return _loc1_.toString() + "e" + _loc2_.toString();
      }
      
      public function numberValue() : Number
      {
         return this.base * Math.pow(10,this.power);
      }
      
      public function toFloat() : Number
      {
         return this.base * Math.pow(10,this.power);
      }
      
      public function normalize2() : void
      {
         if(this.base == 0)
         {
            this.power = 0;
            return;
         }
         var _loc1_:Number = Math.floor(Math.log(this.base) / 2.302585092994045);
         this.base /= Math.pow(10,_loc1_);
         this.power += _loc1_;
      }
      
      public function normalize() : void
      {
         var _loc1_:Number = NaN;
         if(this.base == 0)
         {
            this.power = 0;
            return;
         }
         var _loc2_:Number = Math.abs(this.base);
         if(_loc2_ >= 10)
         {
            _loc1_ = Math.floor(Math.log(_loc2_) / 2.302585092994045);
            this.base /= Math.pow(10,_loc1_);
            this.power += _loc1_;
         }
         else if(_loc2_ < 1)
         {
            _loc1_ = 0 - Math.floor(Math.log(_loc2_) / 2.302585092994045);
            this.base *= Math.pow(10,_loc1_);
            this.power -= _loc1_;
         }
      }
      
      public function negate() : BigNumber
      {
         var _loc1_:BigNumber = copy(this);
         _loc1_.base = -1 * this.base;
         return _loc1_;
      }
      
      public function fromFloat(param1:Number) : void
      {
         this.base = param1;
         this.power = 0;
         this.normalize();
      }
      
      public function add(param1:BigNumber) : BigNumber
      {
         var _loc4_:Number = NaN;
         var _loc2_:BigNumber = copy(this);
         var _loc3_:Number = _loc2_.power - param1.power;
         if(_loc3_ > 10)
         {
            return _loc2_;
         }
         if(_loc3_ < -10)
         {
            _loc2_.base = param1.base;
            _loc2_.power = param1.power;
            return _loc2_;
         }
         if(_loc3_ == 0)
         {
            _loc2_.base += param1.base;
            _loc2_.normalize();
            return _loc2_;
         }
         if(_loc3_ > 0)
         {
            _loc2_.base *= Math.pow(10,_loc3_);
            _loc2_.power = param1.power;
            _loc2_.base += param1.base;
            _loc2_.normalize();
            return _loc2_;
         }
         if(_loc3_ < 0)
         {
            _loc4_ = param1.base * Math.pow(10,-_loc3_);
            _loc2_.base += _loc4_;
            _loc2_.normalize();
            return _loc2_;
         }
         return _loc2_;
      }
      
      public function plusEquals(param1:BigNumber) : void
      {
         var _loc3_:Number = NaN;
         var _loc2_:Number = this.power - param1.power;
         if(_loc2_ > 10)
         {
            return;
         }
         if(_loc2_ < -10)
         {
            this.base = param1.base;
            this.power = param1.power;
            return;
         }
         if(_loc2_ == 0)
         {
            this.base += param1.base;
            this.normalize();
            return;
         }
         if(_loc2_ > 0)
         {
            this.base *= Math.pow(10,_loc2_);
            this.power = param1.power;
            this.base += param1.base;
            this.normalize();
            return;
         }
         if(_loc2_ < 0)
         {
            _loc3_ = param1.base * Math.pow(10,-_loc2_);
            this.base += _loc3_;
            this.normalize();
            return;
         }
      }
      
      public function plusEqualsN(param1:Number) : void
      {
         var _loc4_:Number = NaN;
         var _loc7_:Number = NaN;
         if(param1 == 0)
         {
            return;
         }
         var _loc2_:Number = param1;
         var _loc3_:Number = 0;
         var _loc5_:Number;
         if((_loc5_ = Math.abs(_loc2_)) >= 10)
         {
            _loc4_ = Math.floor(Math.log(_loc5_) / 2.302585092994045);
            _loc2_ /= Math.pow(10,_loc4_);
            _loc3_ += _loc4_;
         }
         else if(_loc5_ < 1)
         {
            _loc4_ = 0 - Math.floor(Math.log(_loc5_) / 2.302585092994045);
            _loc2_ *= Math.pow(10,_loc4_);
            _loc3_ -= _loc4_;
         }
         var _loc6_:Number;
         if((_loc6_ = this.power - _loc3_) > 10)
         {
            return;
         }
         if(_loc6_ < -10)
         {
            this.base = _loc2_;
            this.power = _loc3_;
            return;
         }
         if(_loc6_ == 0)
         {
            this.base += _loc2_;
            this.normalize();
            return;
         }
         if(_loc6_ > 0)
         {
            this.base *= Math.pow(10,_loc6_);
            this.power = _loc3_;
            this.base += _loc2_;
            this.normalize();
            return;
         }
         if(_loc6_ < 0)
         {
            _loc7_ = _loc2_ * Math.pow(10,-_loc6_);
            this.base += _loc7_;
            this.normalize();
            return;
         }
      }
      
      public function minusEquals(param1:BigNumber) : void
      {
         var _loc3_:Number = NaN;
         var _loc2_:Number = this.power - param1.power;
         if(_loc2_ > 10)
         {
            return;
         }
         if(_loc2_ < -10)
         {
            this.base = -param1.base;
            this.power = param1.power;
            return;
         }
         if(_loc2_ == 0)
         {
            this.base -= param1.base;
            this.normalize();
            return;
         }
         if(_loc2_ > 0)
         {
            this.base *= Math.pow(10,_loc2_);
            this.power = param1.power;
            this.base -= param1.base;
            this.normalize();
            return;
         }
         if(_loc2_ < 0)
         {
            _loc3_ = param1.base * Math.pow(10,-_loc2_);
            this.base -= _loc3_;
            this.normalize();
            return;
         }
      }
      
      public function addN(param1:Number) : BigNumber
      {
         return this.add(new BigNumber(param1));
      }
      
      public function subtract(param1:BigNumber) : BigNumber
      {
         var _loc2_:BigNumber = copy(param1);
         _loc2_.base = -_loc2_.base;
         return this.add(_loc2_);
      }
      
      public function multiply(param1:BigNumber) : BigNumber
      {
         var _loc2_:BigNumber = copy(this);
         _loc2_.base *= param1.base;
         _loc2_.power += param1.power;
         _loc2_.normalize();
         return _loc2_;
      }
      
      public function timesEquals(param1:BigNumber) : void
      {
         this.base *= param1.base;
         this.power += param1.power;
         this.normalize();
      }
      
      public function multiplyN(param1:Number) : BigNumber
      {
         var _loc2_:BigNumber = copy(this);
         _loc2_.base *= param1;
         _loc2_.normalize();
         return _loc2_;
      }
      
      public function timesEqualsN(param1:Number) : void
      {
         this.base *= param1;
         this.normalize();
      }
      
      public function divide(param1:BigNumber) : BigNumber
      {
         var _loc2_:BigNumber = copy(this);
         var _loc3_:Number = _loc2_.base / param1.base;
         if(_loc3_ < 10000)
         {
            _loc3_ *= 10000;
            _loc2_.power -= 4;
         }
         _loc2_.base = _loc3_;
         _loc2_.power -= param1.power;
         _loc2_.normalize();
         return _loc2_;
      }
      
      public function divideN(param1:Number) : BigNumber
      {
         return this.divide(new BigNumber(param1));
      }
      
      public function divideToPercent(param1:BigNumber) : BigNumber
      {
         return this.divide(param1);
      }
      
      public function sqrt() : BigNumber
      {
         var _loc1_:BigNumber = copy(this);
         if(_loc1_.power % 2 != 0)
         {
            --_loc1_.power;
            _loc1_.base *= 10;
         }
         _loc1_.base = Math.sqrt(_loc1_.base);
         _loc1_.power /= 2;
         _loc1_.normalize();
         return _loc1_;
      }
      
      public function pow(param1:int) : BigNumber
      {
         var _loc2_:BigNumber = copy(this);
         var _loc3_:BigNumber = new BigNumber(1);
         if(param1 == 0)
         {
            return _loc3_;
         }
         if(param1 < 0)
         {
            _loc2_ = _loc3_.divide(_loc2_);
            param1 = -param1;
         }
         while(param1 > 1)
         {
            if(param1 % 2 == 0)
            {
               _loc2_.base *= _loc2_.base;
               _loc2_.power += _loc2_.power;
               _loc2_.normalize();
               param1 /= 2;
            }
            else
            {
               _loc3_.base = _loc2_.base * _loc3_.base;
               _loc3_.power = _loc2_.power + _loc3_.power;
               _loc3_.normalize();
               _loc2_.base *= _loc2_.base;
               _loc2_.power += _loc2_.power;
               _loc2_.normalize();
               param1 = (param1 - 1) / 2;
            }
         }
         _loc2_.base *= _loc3_.base;
         _loc2_.power += _loc3_.power;
         _loc2_.normalize();
         return _loc2_;
      }
      
      public function powN(param1:Number) : BigNumber
      {
         var _loc2_:BigNumber = copy(this);
         _loc2_.base = Math.pow(_loc2_.base,param1);
         _loc2_.power *= param1;
         _loc2_.normalize();
         return _loc2_;
      }
      
      public function percentIncreaseToMultiplier() : BigNumber
      {
         return this.multiplyN(0.01).addN(1);
      }
      
      public function atLeastOne() : void
      {
         if(this.power > 1 && this.base > 0)
         {
            return;
         }
         if(this.gteN(1))
         {
            return;
         }
         this.base = 1;
         this.power = 0;
      }
      
      public function max(param1:BigNumber) : BigNumber
      {
         var _loc2_:BigNumber = null;
         if(this.gte(param1))
         {
            _loc2_ = copy(this);
         }
         else
         {
            _loc2_ = copy(param1);
         }
         return _loc2_;
      }
      
      public function min(param1:BigNumber) : BigNumber
      {
         var _loc2_:BigNumber = null;
         if(this.lte(param1))
         {
            _loc2_ = copy(this);
         }
         else
         {
            _loc2_ = copy(param1);
         }
         return _loc2_;
      }
      
      public function lte(param1:BigNumber) : Boolean
      {
         var _loc2_:Number = NaN;
         if(this.base == 0)
         {
            return param1.base >= 0;
         }
         if(param1.base == 0)
         {
            return this.base <= 0;
         }
         if(this.base < 0 != param1.base < 0)
         {
            return this.base < param1.base;
         }
         _loc2_ = this.base > 0 ? 1 : -1;
         if(_loc2_ * this.power > _loc2_ * param1.power)
         {
            return false;
         }
         if(this.power == param1.power)
         {
            return this.base <= param1.base;
         }
         return true;
      }
      
      public function gte(param1:BigNumber) : Boolean
      {
         var _loc2_:Number = NaN;
         if(this.base == 0)
         {
            return param1.base <= 0;
         }
         if(param1.base == 0)
         {
            return this.base >= 0;
         }
         if(this.base < 0 != param1.base < 0)
         {
            return this.base > param1.base;
         }
         _loc2_ = this.base > 0 ? 1 : -1;
         if(_loc2_ * this.power < _loc2_ * param1.power)
         {
            return false;
         }
         if(this.power == param1.power)
         {
            return this.base >= param1.base;
         }
         return true;
      }
      
      public function gt(param1:BigNumber) : Boolean
      {
         var _loc2_:Number = NaN;
         if(this.base == 0)
         {
            return param1.base < 0;
         }
         if(param1.base == 0)
         {
            return this.base > 0;
         }
         if(this.base < 0 != param1.base < 0)
         {
            return this.base > param1.base;
         }
         _loc2_ = this.base > 0 ? 1 : -1;
         if(_loc2_ * this.power < _loc2_ * param1.power)
         {
            return false;
         }
         if(this.power == param1.power)
         {
            return this.base > param1.base;
         }
         return true;
      }
      
      public function lt(param1:BigNumber) : Boolean
      {
         var _loc2_:Number = NaN;
         if(this.base == 0)
         {
            return param1.base > 0;
         }
         if(param1.base == 0)
         {
            return this.base < 0;
         }
         if(this.base < 0 != param1.base < 0)
         {
            return this.base < param1.base;
         }
         _loc2_ = this.base > 0 ? 1 : -1;
         if(_loc2_ * this.power > _loc2_ * param1.power)
         {
            return false;
         }
         if(this.power == param1.power)
         {
            return this.base < param1.base;
         }
         return true;
      }
      
      public function eq(param1:BigNumber) : Boolean
      {
         if(this.power != param1.power)
         {
            return false;
         }
         if(this.base == param1.base)
         {
            return true;
         }
         return false;
      }
      
      public function isPositive() : Boolean
      {
         return this.base > 0;
      }
      
      public function gtN(param1:Number) : Boolean
      {
         if(param1 == 0)
         {
            return this.base > 0;
         }
         if(this.base == 0)
         {
            return param1 < 0;
         }
         if(this.base < 0 != param1 < 0)
         {
            return this.base > param1;
         }
         return this.gt(new BigNumber(param1));
      }
      
      public function ltN(param1:Number) : Boolean
      {
         return this.lt(new BigNumber(param1));
      }
      
      public function gteN(param1:Number) : Boolean
      {
         if(this.base == 0)
         {
            return param1 <= 0;
         }
         if(param1 == 0)
         {
            return this.base >= 0;
         }
         if(this.base < 0 != param1 < 0)
         {
            return this.base > param1;
         }
         return this.gte(new BigNumber(param1));
      }
      
      public function lteN(param1:Number) : Boolean
      {
         return this.lte(new BigNumber(param1));
      }
      
      public function eqN(param1:Number) : Boolean
      {
         return this.eq(new BigNumber(param1));
      }
      
      public function floorInPlace() : void
      {
         var _loc1_:Number = NaN;
         if(this.power < 15)
         {
            _loc1_ = this.power;
            this.base *= Math.pow(10,_loc1_);
            this.power -= _loc1_;
            this.base = Math.floor(this.base);
            this.normalize();
         }
      }
      
      public function floor() : BigNumber
      {
         var _loc2_:Number = NaN;
         var _loc1_:BigNumber = copy(this);
         if(_loc1_.power < 15 && _loc1_.power > -15)
         {
            _loc2_ = _loc1_.power;
            _loc1_.base *= Math.pow(10,_loc2_);
            _loc1_.power -= _loc2_;
            _loc1_.base = Math.floor(_loc1_.base);
            _loc1_.normalize();
         }
         return _loc1_;
      }
      
      public function ceil() : BigNumber
      {
         var _loc2_:Number = NaN;
         var _loc1_:BigNumber = copy(this);
         if(_loc1_.power < 15 && _loc1_.power > -15)
         {
            _loc2_ = _loc1_.power;
            _loc1_.base *= Math.pow(10,_loc2_);
            _loc1_.power -= _loc2_;
            _loc1_.base = Math.ceil(_loc1_.base);
            _loc1_.normalize();
         }
         return _loc1_;
      }
      
      public function round() : BigNumber
      {
         var _loc1_:BigNumber = copy(this);
         var _loc2_:BigNumber = _loc1_.floor();
         if(_loc1_.subtract(_loc2_).gtN(0.5))
         {
            return _loc1_.ceil();
         }
         return _loc2_;
      }
      
      public function get stringRepresentation() : String
      {
         return this.toString();
      }
      
      public function toScientific(param1:BigNumber) : String
      {
         return param1.toString();
      }
      
      public function get numberRepresentation() : String
      {
         return this.numberValue().toString();
      }
      
      public function isNotANumber() : Boolean
      {
         return isNaN(this.base) || isNaN(this.power) || this.toString() == "NaN" || this.toString() == "NaNeInfinity";
      }
   }
}