Skip to content

chore: Upgrade to TypeScript 6.0.3 and API Extractor 7.x - #3315

Open
bc-0dp wants to merge 1 commit into
bigcommerce:masterfrom
bc-0dp:typescript-6-upgrade
Open

chore: Upgrade to TypeScript 6.0.3 and API Extractor 7.x#3315
bc-0dp wants to merge 1 commit into
bigcommerce:masterfrom
bc-0dp:typescript-6-upgrade

Conversation

@bc-0dp

@bc-0dp bc-0dp commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

What/Why?

Upgrade the SDK from TypeScript 5.8 to 6.0.3 (via a 5.9 checkpoint), ahead of the eventual TypeScript 7 (native) move. TS 6.0 is a transitional release; its breaking changes are handled here. Also migrates the declaration rollup from @microsoft/api-extractor 6.3.0 (bundled TS 3.1) to 7.58.9.

Key changes:

  • tsconfig.base.json: "ignoreDeprecations": "6.0" (silences baseUrl, moduleResolution node10, and target es5 pending the TS 7 migration) and "types": ["*"] to restore the pre-6.0 automatic @types global inclusion.
  • ts-loader now uses an explicit configFile with onlyCompileBundledFiles, so the webpack build type-checks only bundled files, not the whole repo (TS 6.0 defaults strict: true and types: []).
  • build-dts passes --rootDir .. (TS 6.0 no longer infers rootDir for the multi-package emit) and strips api-extractor 7.x export { } markers, so consumers keep importing the SDK's bare-declared types, matching the long-standing published .d.ts shape.
  • Migrated 6 api-extractor configs and the auto-export generator to the 7.x schema.
  • .npmrc legacy-peer-deps=true works around @bigcommerce/eslint-config's stale optional typescript peer (^4 || ^5); added @bigcommerce/eslint-plugin as a direct devDep so ESLint resolves it.

Reviewer note: the docs/ diff includes api-extractor 7.x numeric disambiguation renames (e.g. Omit.md becomes Omit_2.md, PaymentProviderCustomerType becomes PaymentProviderCustomer_2). Content is unchanged; only the internal collision labels differ.

Rollout/Rollback

Tooling and build-config change only. No runtime feature flags, experiments, or migrations. The published JS bundles are behavior-equivalent (Babel still targets the existing browserslist); only the .d.ts structure and build config change. Rollback is a straight revert of this branch.

Testing

  • SDK, all green under TS 6.0.3: lint (52 projects), test (core 2478 tests plus 51 other projects), build, bundle-dts, docs (587 files), build-cdn.
  • Consumer (checkout-js): typecheck output is byte-identical to the published-SDK baseline (214 pre-existing errors on its master, 0 new). TS2459 "declared locally but not exported" count is 0, confirming the export { } strip. build passes; the test suite reports 1324 pass with 2 pre-existing failures unrelated to the SDK.
  • Sandbox UAT: full checkout flow works end to end (cart, payment, order placement, order confirmation) against the TS6 build.

Note

Medium Risk
Published .d.ts shape and the declaration rollup pipeline change with a major TypeScript and API Extractor jump; runtime JS is unchanged but downstream typecheck compatibility is the main regression surface.

Overview
Upgrades the monorepo toolchain from TypeScript ~5.8 to 6.0.3 and @microsoft/api-extractor from 6.3 to 7.58.9, with lockfile and devDependency updates (@bigcommerce/eslint-plugin, api-extractor’s Rushstack stack).

TypeScript 6 compatibility: tsconfig.base.json adds ignoreDeprecations: "6.0" and types: ["*"] so global @types behavior matches pre-6.0. Webpack ts-loader now points at tsconfig.base.json with onlyCompileBundledFiles: true so bundles are type-checked without pulling the whole repo under TS 6 defaults.

Declaration build: build-dts uses tsc --rootDir .. for multi-package emits, rolls up .d.ts via API Extractor 7 (mainEntryPointFilePath, untrimmedFilePath, overrideTsconfig, suppressed extractor messages), and strips api-extractor 7 export { } lines so published typings stay consumer-friendly. The same pattern applies to core, hosted-form-v2, and auto-export–generated integration configs.

npm: .npmrc sets legacy-peer-deps=true until @bigcommerce/eslint-config declares a TypeScript 6 peer range.

Reviewed by Cursor Bugbot for commit 1774427. Bugbot is set up for automated code reviews on this repo. Configure here.

Move from TypeScript 5.8 to 6.0.3 (via a 5.9 checkpoint) and migrate the
declaration rollup from api-extractor 6.3.0 to 7.58.9.

Adjustments for TS 6.0 breaking changes:
- tsconfig.base.json: set "ignoreDeprecations": "6.0" (baseUrl,
  moduleResolution node10, target es5) and "types": ["*"] to restore the
  pre-6.0 automatic @types global inclusion.
- ts-loader now uses an explicit configFile with onlyCompileBundledFiles so
  the webpack build type-checks only bundled files, not the whole repo.
- build-dts passes --rootDir .. (TS 6.0 no longer infers rootDir) and strips
  api-extractor 7.x "export { }" markers so consumers can import the SDK's
  bare-declared types, matching the long-standing published .d.ts shape.
- Migrated 6 api-extractor configs and the auto-export generator to the 7.x
  schema.
- .npmrc legacy-peer-deps=true works around @bigcommerce/eslint-config's stale
  optional typescript peer (^4 || ^5); added @bigcommerce/eslint-plugin as a
  direct devDep so ESLint resolves it.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 1774427. Configure here.

"tsc --outDir ../../temp --declaration --emitDeclarationOnly",
"tsc --outDir ../../temp --rootDir .. --declaration --emitDeclarationOnly",
"api-extractor run --config api-extractor/hosted-form-v2-iframe-content.json & api-extractor run --config api-extractor/hosted-form-v2-iframe-host.json",
"find ../../dist -maxdepth 1 -name 'hosted-form-v2-iframe-*.d.ts' -type f -exec perl -i -ne 'print unless /^export \\{.*\\}\\s*$/' {} +",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing wait before declaration strip

Medium Severity

The new perl step that strips export { } lines runs as the next Nx command while both api-extractor processes are still backgrounded (&) with no trailing wait. The strip (and following rm -rf ../../temp) can run before rollups finish, yielding incomplete .d.ts files or deleting temp while extractors still read it.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1774427. Configure here.

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.

1 participant