Mottie / javascript-number-formatter

Lightweight & Fast JavaScript Number Formatter
http://mottie.github.io/javascript-number-formatter/
MIT License
141 stars 37 forks source link

Improve TypeScript bindings #20

Closed mingos777 closed 5 years ago

mingos777 commented 5 years ago

Current TypeScript typings mark the third parametre to the format function as required. However, as shown in the doc, it is clearly optional. It should be marked as optional in the TS typings as well.

In TS, in stead of writing:

format("# ###,#", 19.9, {});

I would like to be able to write:

format("# ###,#", 19.9);
Mottie commented 5 years ago

Hi @mingos777!

Thanks for reporting this problem! I haven't used typescript, so I'd appreciate it if you would verify everything is working as expected now - https://github.com/Mottie/javascript-number-formatter/blob/master/index.d.ts

Thanks!

mingos777 commented 5 years ago

The TS typings are correct as of version 2.0.7 and I can omit the last argument without raising a compilation error. Thank you for the quick reaction.