fix(browserstack-service): declare browser.setCustomTags on WebdriverIO.Browser type (SDK-6882)#5
Open
harshit-browserstack wants to merge 1 commit into
Open
Conversation
…IO.Browser type (SDK-6882)
`browser.setCustomTags(key, value)` is attached at runtime by the service but
was not declared on the global `WebdriverIO.Browser` interface in the shipped
type entry (`build/index.d.ts`). The existing declaration in
`src/@types/bstack-service-types.d.ts` reaches only internal source via
`/// <reference path>` and is never emitted to consumers, so TypeScript users
got: `Property 'setCustomTags' does not exist on type 'Browser'.`
Add the augmentation to the `declare global { namespace WebdriverIO {} }` block
in `src/index.ts`, which is emitted to `build/index.d.ts` and delivered to
consumers. Verified: pristine 9.29.1 reproduces the exact TS2339; with this
change built, `tsc` compiles clean (exit 0). Runtime behavior unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
anish353
approved these changes
Jul 10, 2026
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.
What
Declares
browser.setCustomTags(key, value)on the globalWebdriverIO.Browserinterface so TypeScript consumers of@wdio/browserstack-servicecan call it without a compile error.Why
Jira SDK-6882: a WebdriverIO + Mocha (TypeScript) customer on
@wdio/browserstack-service@9.29.1hit:The command works at runtime (the service attaches it, and the customer's test calling it passed) — the failure is compile-time only. The
setCustomTags/a11y declarations live insrc/@types/bstack-service-types.d.tsbut that file usesdeclare namespaceand is pulled in only via/// <reference path>from internal source, so it is never emitted into the shippedbuild/index.d.ts(the packagetypesentry). Consumers therefore receive noWebdriverIO.Browseraugmentation.Fix
Add the augmentation to the
declare global { namespace WebdriverIO {} }block insrc/index.ts, which is emitted tobuild/index.d.tsand delivered to consumers:Merges cleanly with the existing ambient declaration (identical signature).
Verification
@wdio/browserstack-service@9.29.1→tscreproduces the exactTS2339(exit 2).pnpm build, exit 0), the regeneratedbuild/index.d.tsemits theinterface Browser { setCustomTags }augmentation; the same minimal project then compiles clean (tscexit 0).Scope / follow-up
Scoped to
setCustomTags(the reported symptom). The a11y methods (getAccessibilityResults,performScan, …) share the same non-shipping cause and remain untyped for consumers — a follow-up could wire the fullbstack-service-types.d.ts(incl.MultiRemoteBrowser) into the shipped types.🤖 Generated with Claude Code