Skip to content

fix(core): add pseudoClassEnabledElements to TypeScript types (PPLT-5013)#2204

Merged
Manoj-Katta merged 1 commit intomasterfrom
PPLT-5013/types-pseudo-class-enabled-elements
Apr 29, 2026
Merged

fix(core): add pseudoClassEnabledElements to TypeScript types (PPLT-5013)#2204
Manoj-Katta merged 1 commit intomasterfrom
PPLT-5013/types-pseudo-class-enabled-elements

Conversation

@Manoj-Katta
Copy link
Copy Markdown
Contributor

@Manoj-Katta Manoj-Katta commented Apr 29, 2026

Summary

  • Add pseudoClassEnabledElements to CommonSnapshotOptions in @percy/core's type definition (packages/core/types/index.d.ts), mirroring the runtime config schema in packages/core/src/config.js.
  • Add positive (expectType) and negative (expectError) tsd assertions in packages/core/types/index.test-d.ts.

Why

The runtime config schema has accepted pseudoClassEnabledElements since the original PPLT-5013 fix, but the TypeScript definition in @percy/core did not include it. As a result, TypeScript users have to suppress type errors (// @ts-ignore or as any) when passing the option to percySnapshot(). This was reported in customer ticket PER-6872 (Salsify):

"the TypeScript type for percySnapshot does not include the pseudoClassEnabledElements field, which means in a TS codebase I have to suppress a type error in order to set that option when passing it directly."

Since every Percy SDK (@percy/ember, @percy/puppeteer, @percy/playwright, @percy/selenium, @percy/webdriverio, etc.) imports SnapshotOptions from @percy/core, this single change fixes the type for all of them.

Test plan

  • yarn test:types passes inside packages/core
  • Verified in a standalone TS scratch project with file: link to local @percy/core:
    • Positive: valid { selectors, id, className, xpath } compiles cleanly.
    • Negative: an unknown sub-property (unknown: ['x']) is rejected by tsc with TS2353, confirming the type is not loosened to any.

Related

  • Customer ticket: PER-6872
  • Original feature: PPLT-5013

…013)

The runtime config schema accepted `pseudoClassEnabledElements`, but the
TypeScript definition in @percy/core did not include it, forcing TS users
to suppress type errors when passing the option to percySnapshot. Adding
it to CommonSnapshotOptions fixes the type for every SDK that imports
SnapshotOptions from @percy/core (ember, puppeteer, playwright, selenium,
webdriverio, etc.).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Manoj-Katta Manoj-Katta requested a review from a team as a code owner April 29, 2026 07:45
@Manoj-Katta Manoj-Katta merged commit 4fb6a91 into master Apr 29, 2026
62 of 63 checks passed
@Manoj-Katta Manoj-Katta deleted the PPLT-5013/types-pseudo-class-enabled-elements branch April 29, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants