Fix export default for all colors
Problems
For example if I do this, will get an error:
import c from 'colorette'
// types safe but get the error in runtime.
c.cyan('hello') // TypeError: Cannot read properties of undefined (reading 'cyan')
And then need to change to:
import * as c from 'colorette'
c.cyan('hello')
So I'm not sure if there was a special reason for this design? otherwise the general import usage case would be more reasonable and matched the type system.😅
What you say about the types is true, but it was probably a mistake since I didn't intend to support default exports.
Named exports, default exports, or both? Which one is more idiomatic in Node? Should we even have a default export?
@jorgebucaran Well, if you don't intend to support default exports, you should fix types avoid a mistake for users.
Also chalk did export default if this project expects as a alternative.
Of course. Can you show us how to fix them? As I said, this was likely a mistake, because I didn't intend to support default exports when I wrote the types.
Now, I'm open to discussing adding them in the future.