fix(types): allow string[] label values#774
Closed
AysajanE wants to merge 1 commit into
Closed
Conversation
Signed-off-by: Aysajan Eziz <aeziz@northset.ai>
jdmarshall
reviewed
Jul 13, 2026
jdmarshall
left a comment
Contributor
There was a problem hiding this comment.
This is a subset of #553 that doesn't really move things forward and there was resistance to landing that one that hasn't really abated.
Just making it work for counter isn't really answering the ticket.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
prom-client accepts an array of strings as a label value at runtime — e.g.
.inc({ handler: ['/a', '/b'] }), which renders ashandler="/a,/b"— but its TypeScript types reject it: the label-values type only allowsstring | number, so that call fails to type-check even though it works. Reported in #582.Change
index.d.ts: widen the label-values type tostring | number | string[]so array-valued labels type-check.test/typescript.ts: add an array-valued-label usage sotscproves the type now accepts it.Checks (Node 22)
npm run compile-typescript(tsc --project .) andnpm run test-unit— both pass.Fixes #582
Disclosure: this change was prepared with AI assistance and reviewed by me before submitting.
I ran the check(s) above in a network-isolated container and published a signed, re-runnable
record of that run, verifiable via GitHub artifact attestation:
https://northset-oss.github.io/verification-pilot/. Contributor self-run, not a maintainer verification.