Repository navigation
@types/node: Permit passing hex color in array argument of styleText utility - #75656
Conversation
|
@delucis Thank you for submitting this PR! This is a live comment that I will keep updated. 1 package in this PR
Code ReviewsBecause this is a widely-used package, a DT maintainer will need to review it before it can be merged. You can test the changes of this PR in the Playground. Status
All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 75656,
"author": "delucis",
"headCommitOid": "365fa6c8a7ba82abfdc3f0d83d86d6318166b31b",
"mergeBaseOid": "ac3977d854a671215b8d3e2d5e4ced9c345bf00b",
"lastPushDate": "2026-10-03T10:12:54.000Z",
"lastActivityDate": "2026-10-09T18:24:08.000Z",
"mergeOfferDate": "2026-10-09T18:16:12.000Z",
"mergeRequestDate": "2026-10-09T18:24:08.000Z",
"mergeRequestUser": "delucis",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"tooManyCommits": false,
"tooManyReviews": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "node",
"version": "26.6",
"kind": "edit",
"files": [
{
"path": "types/node/node-tests/util.ts",
"kind": "test"
},
{
"path": "types/node/util.d.ts",
"kind": "definition"
},
{
"path": "types/node/v24/test/util.ts",
"kind": "test"
},
{
"path": "types/node/v24/util.d.ts",
"kind": "definition"
}
],
"owners": [
"Microsoft",
"jkomyno",
"r3nya",
"btoueg",
"touffy",
"mohsen1",
"galkin",
"eps1lon",
"WilcoBakker",
"trivikr",
"yoursunny",
"ExE-Boss",
"peterblazejewicz",
"addaleax",
"NodeJS",
"LinusU",
"wafuwafu13",
"mcollina",
"Semigradsky",
"Renegade334",
"anonrig"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "johnfav03",
"date": "2026-10-09T18:15:32.000Z",
"isMaintainer": true
},
{
"type": "approved",
"reviewer": "Renegade334",
"date": "2026-10-04T20:01:10.000Z",
"isMaintainer": false
},
{
"type": "approved",
"reviewer": "anonrig",
"date": "2026-10-03T17:05:22.000Z",
"isMaintainer": false
}
],
"mainBotCommentID": 5968153026,
"ciResult": "pass"
} |
|
🔔 @microsoft @jkomyno @r3nya @btoueg @Touffy @mohsen1 @galkin @eps1lon @WilcoBakker @trivikr @yoursunny @ExE-Boss @peterblazejewicz @addaleax @nodejs @LinusU @wafuwafu13 @mcollina @Semigradsky @Renegade334 @anonrig — please review this PR in the next few days. Be sure to explicitly select |
| * The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v26.x/api/util.html#modifiers). | ||
| * @param format A text format or an Array of text formats defined in `util.inspect.colors`, or a hex color in `#RGB` | ||
| * or `#RRGGBB` form. | ||
| * @param format A text format defined in `util.inspect.colors`, a hex color in `#RGB` or `#RRGGBB` form, |
There was a problem hiding this comment.
Any changes to docblocks will be overwritten from source at some point, if you want this to be reflected in the documentation then please open a PR at nodejs/node.
There was a problem hiding this comment.
Thanks for the pointer! I opened nodejs/node#66539 to do this — hopefully I got it right, it’s my first time contributing to the Node repo.
|
@delucis: Everything looks good here. I am ready to merge this PR (at 365fa6c) on your behalf whenever you think it's ready. If you'd like that to happen, please post a comment saying:
and I'll merge this PR almost instantly. Thanks for helping out! ❤️ (@microsoft, @jkomyno, @r3nya, @btoueg, @Touffy, @mohsen1, @galkin, @eps1lon, @WilcoBakker, @trivikr, @yoursunny, @ExE-Boss, @peterblazejewicz, @addaleax, @nodejs, @LinusU, @wafuwafu13, @mcollina, @Semigradsky, @Renegade334, @anonrig: you can do this too.) |
|
Ready to merge |
8cbe925
into
DefinitelyTyped:master
Types for hex color strings were added in #75153 (v26) and #75574 (v24), but only in the non-array form, e.g.
styleText("#f00", "red text"). Node also supports passing hex colors inside an array to combine with other modifiers, e.g.styleText(["#f00", "bold"], "bold red text"). This PR updates the types, docs, and tests to reflect that support for both Node v24 and v26.Please fill in this template.
pnpm test node.Select one of these and delete the others:
If changing an existing definition:
styleText()showing the handling for hex codes when passed in an array. The same logic is present in Node 26. I also tested locally with the Node.js REPL showing this working, including the same behaviour as with other modifiers where a hex colour later in the array overrides one earlier in the array: