fix: resolve TypeScript build warnigs on Gen2#6280
Conversation
- 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
|
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen 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: If the changes are expected, update the |
Description
Fixes three issues that were preventing
yarn build:2nd-genfrom completing cleanly:Button.base.ts—_pendingTimerwas typed asnumber | null, butsetTimeoutreturnsReturnType<typeof setTimeout>(which isNodeJS.Timeoutunder the DTS build's resolution), notnumber. Updated the type accordingly.StatusLight.base.ts— thevariant === 'accent'check is an intentional runtime guard for 1st-gen consumers who may still pass the deprecated'accent'value, but the declaredStatusLightVarianttype doesn't include it, so TS2367 flagged the comparison as unreachable. Added// @ts-expect-errorwith 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.swc/package.json—vite.config.tsimports@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 aworkspace:*devDependency (matching@adobe/postcss-tokenand@adobe/swc-tokens) and refreshedyarn.lock.Motivation and context
yarn build:2nd-genwas throwing some annoying warnings.Related issue(s)
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
2nd-gen build is clean
yarn build:2nd-genERR_MODULE_NOT_FOUNDfor@adobe/vite-global-elements-css.StatusLight
'accent'deprecation warning still fires<sp-status-light variant="accent">(1st-gen-style usage)Device review
Accessibility testing checklist
No runtime behavior or DOM changes; build-only fixes. Surrounding components were not modified.
<sp-button>and<sp-status-light>examples)