Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Be ready for numbers, undefined and null #14

Closed
ai opened this issue Sep 27, 2021 · 2 comments
Closed

Be ready for numbers, undefined and null #14

ai opened this issue Sep 27, 2021 · 2 comments

Comments

@ai
Copy link
Contributor

ai commented Sep 27, 2021

Default JS is not type safe. It is very easy to make a mistake and send number to red(result).

It will be much easy to migrate projects if types will support at least numbers and code will be ready for numbers, undefined and null.

@alexeyraspopov
Copy link
Owner

Now that we have benchmarks, I think it should be easier to iterate on this thing. My initial idea was to not introduce any sort of input checking, assuming users either will face the runtime error during testing and fix it or simply use type checking systems.

@ai
Copy link
Contributor Author

ai commented Sep 30, 2021

assuming users either will face the runtime error during testing and fix it or simply use type checking systems

There are 2 problems with it:

  1. Sometimes variables can be string or undefined, which will block users from catching all errors during test
  2. Current stacktrace on non-string value is confusing. It is easy to miss that picocolors works only with strings (because all other works with other values).

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

Successfully merging a pull request may close this issue.

2 participants