Skip to content

fix: resolve TypeScript build warnigs on Gen2#6280

Open
rubencarvalho wants to merge 1 commit into
mainfrom
rcarvalho/fix-2nd-gen-ts-build-errors
Open

fix: resolve TypeScript build warnigs on Gen2#6280
rubencarvalho wants to merge 1 commit into
mainfrom
rcarvalho/fix-2nd-gen-ts-build-errors

Conversation

@rubencarvalho
Copy link
Copy Markdown
Contributor

@rubencarvalho rubencarvalho commented May 12, 2026

Description

Fixes three issues that were preventing yarn build:2nd-gen from completing cleanly:

  1. Button.base.ts_pendingTimer was typed as number | null, but setTimeout returns ReturnType<typeof setTimeout> (which is NodeJS.Timeout under the DTS build's resolution), not number. Updated the type accordingly.
  2. StatusLight.base.ts — the variant === 'accent' check is an intentional runtime guard for 1st-gen consumers who may still pass the deprecated 'accent' value, but the declared StatusLightVariant type doesn't include it, so TS2367 flagged the comparison as unreachable. Added // @ts-expect-error with a comment so the guard stays but TS knows the mismatch is intentional. If 'accent' is ever added to the type, TS will fail the line and force a re-evaluation of the guard.
  3. swc/package.jsonvite.config.ts imports @adobe/vite-global-elements-css, but the package was only wired through a Vite resolve alias. Vite loads its own config via Node's ESM loader before any aliases apply, so the import failed at config-load time. Added the package as a workspace:* devDependency (matching @adobe/postcss-token and @adobe/swc-tokens) and refreshed yarn.lock.

Motivation and context

yarn build:2nd-gen was throwing some annoying warnings.

Related issue(s)

  • N/A (build hygiene)

Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • 2nd-gen build is clean

    1. yarn build:2nd-gen
    2. Expect both core and swc workspaces to complete without TypeScript errors or ERR_MODULE_NOT_FOUND for @adobe/vite-global-elements-css.
  • StatusLight 'accent' deprecation warning still fires

    1. In a debug build, render <sp-status-light variant="accent"> (1st-gen-style usage)
    2. Expect the runtime deprecation warning pointing to the migration guide, same as before.

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

Accessibility testing checklist

No runtime behavior or DOM changes; build-only fixes. Surrounding components were not modified.

  • Keyboard — N/A (no focusable parts changed; confirm no regressions in <sp-button> and <sp-status-light> examples)
  • Screen reader — N/A (no labels, roles, or ARIA changed)

- Button.base.ts: type _pendingTimer as ReturnType<typeof setTimeout>
  instead of number (Node returns Timeout, not number)
- StatusLight.base.ts: add @ts-expect-error for intentional runtime
  guard checking deprecated 'accent' variant from 1st-gen consumers
- swc/package.json: declare @adobe/vite-global-elements-css as a
  workspace devDependency so vite.config.ts resolves it at load time
@rubencarvalho rubencarvalho requested a review from a team as a code owner May 12, 2026 21:35
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 12, 2026

⚠️ No Changeset found

Latest commit: 5e11fae

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rubencarvalho rubencarvalho changed the title fix(2nd-gen): resolve TypeScript build errors fix: resolve TypeScript build warnigs on Gen2 May 12, 2026
@rubencarvalho rubencarvalho added the Status:Ready for review PR ready for review or re-review. label May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📚 Branch Preview Links

🔍 First Generation Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-6280

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

Copy link
Copy Markdown
Member

@cdransf cdransf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status:Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants