You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
👋 Hello, first of all happy new year! 🥳
After migrating a couple projects from chalk to picocolors I've stumbled upon the same issue in some migrations in TypeScript projects.
With chalk it's possible to pass all types compared to picocolors, this because chalk doesn't put any constrains to the input arguments.
I like that this is more type-safe, on the other hand it makes it less developer friendly.
That's why I propose to expand the types to all primitive types (and arrays of primitive types).
If accepted I can create a PR with the change.
This change will only update the types, the runtime behavior remains the same because it works already as expected.
The text was updated successfully, but these errors were encountered:
timdeschryver
changed the title
boolean and array types
Support boolean and array types
Jan 2, 2025
👋 Hello, first of all happy new year! 🥳
After migrating a couple projects from
chalk
topicocolors
I've stumbled upon the same issue in some migrations in TypeScript projects.With chalk it's possible to pass all types compared to
picocolors
, this because chalk doesn't put any constrains to the input arguments.https://github.com/chalk/chalk/blob/5dbc1e2633f3874f43c144fa4919934bc934c495/source/index.d.ts#L33
Picocolors only accepts the following types,
string | number | null | undefined
.picocolors/types.d.ts
Line 1 in 0e7c4af
Example (https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAYwBYEMA2BrOAzKERwDky6GhA3AFCiSxxjAIQ54GENNNrQDOFllAPSC4Ad2gYelJgDseENAFMAdNwDmAChKZlaqIsUyNMKAFdFASgtVZ8paoibtGZQBNQG7Oh6Xr0iHIKKupaqDoARmjmGgDaXmg+ADRwJuYAulZUQiIwAJ5gigC0ilB4UP6B9iEcELr6hsZmvjYBdsGOGjVuHvE+mRVtDppdkdFx3orJqYoZ1kA):
I like that this is more type-safe, on the other hand it makes it less developer friendly.
That's why I propose to expand the types to all primitive types (and arrays of primitive types).
If accepted I can create a PR with the change.
This change will only update the types, the runtime behavior remains the same because it works already as expected.
The text was updated successfully, but these errors were encountered: