refactor: replace unsafe Number constructor with type-safe alternatives
Motivation
Remove usage of Number constructor
Description
The Number constructor is very unsafe because:
It takes any as parameter. If we change from passing a string to Number to some object Typescript will compile and we'll get NaN. If you do a text search of the Number constructor there are many occurrences:
If Number arg is already an argument, remove If Number arg is a string, use parseInt() If Number arg is a bigint, use a custom util that types like bigintToNumber(bn: bigint): number If the input of any of those functions is un-trusted data, verify the return is not NaN
Closes #3779
Steps to test or reproduce Run all tests
there seem to be merge conflicts, this needs to be resolved, otherwise we can't run the CI
putting this into draft for now
closing stale PR
@wemeetagain I will get this one done tomorrow, apologies
Hello @nflaig , i made a PR, kindly help review it, thank you