Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Consider using string rather than String(). #134

Closed
johnjbarton opened this issue Apr 11, 2017 · 1 comment
Closed

Consider using string rather than String(). #134

johnjbarton opened this issue Apr 11, 2017 · 1 comment

Comments

@johnjbarton
Copy link
Contributor

In working on a PR #130 I hit mysterious problems on a couple of occasions that I eventually traced back to String vs string.

Which of these one uses almost never matters. Except when it does, then 'string' will win.

http://stackoverflow.com/questions/14727044/typescript-difference-between-string-and-string

For example, one of the issues I hit was from a type test in colors:
https://github.com/Marak/colors.js/blob/master/lib/extendStringPrototype.js#L79
When I send a String, the code throws. I suppose the issue is in combination with some other setting special to testing, but there isn't really any advantage to String.

@bcaudan
Copy link
Owner

bcaudan commented Apr 11, 2017

Thanks for raising this point.

IIRC, I had some type issues due to String prototype extension by color.js. Eventually, I kept String.
I will have a deeper look into it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants