adamwdraper / Numeral-js

A javascript library for formatting and manipulating numbers.
http://numeraljs.com
MIT License
9.66k stars 929 forks source link

referencing methods dynamically results in `Type 'Numeral' has no call signatures` #794

Open Mottoweb opened 2 months ago

Mottoweb commented 2 months ago

I am trying to access methods of numeral dynamically in typescript like so:

numeral(currentPrice)[method as keyof Numeral](priceDiff).format('0.00000')

which results in Type 'Numeral' has no call signatures type error, as far as i understand its because type Numeral is declared as class rather than interface, any help for a workaround or a fix would be much appreciated