Skip to content

fix(sdk): declare type peers for TS-source driver and shared packages - #7458

Merged
cuisongliu merged 1 commit into
mainfrom
fix/driver-sdk-types-peer
Nov 23, 2026
Merged

cuisongliu merged 1 commit into
mainfrom
fix/driver-sdk-types-peer

Conversation

@norberia

Copy link
Copy Markdown
Contributor

Summary

@labring/sealos-driver-sdk (frontend/packages/driver) and @labring/sealos-shared-sdk (frontend/packages/shared) are published as TypeScript source, so every consumer type-checks them during next build. Both import modules whose type declarations come from @types/* packages that were only listed as devDependencies:

Package Import Missing types
driver react-dom/client (src/popover.tsx) @types/react-dom (also uses @types/react)
shared js-yaml (src-server/config/reader.ts), react @types/js-yaml, @types/react

devDependencies are not installed for consumers, so TypeScript only finds these declarations if pnpm happens to hoist them into node_modules/.pnpm/node_modules. When it doesn't, consumer builds fail with TS7016, e.g. in sealos-apps/database release-v5.2:

@labring/sealos-driver-sdk/src/popover.tsx:8:28
Type error: Could not find a declaration file for module 'react-dom/client'.

and, once that is fixed, the same error for js-yaml in @labring/sealos-shared-sdk/src-server/config/reader.ts.

Change

  • driver: add optional peers @types/react and @types/react-dom (^18.0 || ^19.0), bump to 1.0.1.
  • shared: add optional peers @types/js-yaml (^4) and @types/react (^18.0 || ^19.0), bump to 1.0.4.

With the peers declared, pnpm links the consumer's @types packages next to the SDK, so resolution no longer depends on hoisting. They are optional, so consumers that don't type-check are unaffected. No source changes; frontend/pnpm-lock.yaml is unchanged (pnpm install --lockfile-only with pnpm 8.9.0 produces no diff).

Test plan

  • pnpm install --frozen-lockfile (pnpm 8.9.0) succeeds; lockfile unchanged
  • driver tsc --noEmit; shared pnpm typecheck and pnpm lint; desktop (the in-repo consumer) tsc --noEmit and next lint (pre-existing warnings only)
  • Release candidates built as documented (frontend/scripts/prepare-npm-packages.mjs + npm pack): file lists and src/ contents identical to the published sealos-driver-sdk@1.0.0 / sealos-shared-sdk@1.0.3; manifests differ only in version and the new peer fields
  • Consumer reproduction (sealos-apps/database release-v5.2, unmodified Dockerfile, SDKs overridden to the candidate tarballs): with the published versions the build fails with the react-dom/client error; with the candidates both SDK type errors are gone and type-checking passes
  • Publish @labring/sealos-driver-sdk@1.0.1 and @labring/sealos-shared-sdk@1.0.4

Generated with Devin

@labring/sealos-driver-sdk and @labring/sealos-shared-sdk ship TypeScript
source, so consumers type-check it. driver imports react-dom/client and
shared imports js-yaml and react, but their @types packages were only
devDependencies. Consumers therefore depended on pnpm hoisting those
@types into node_modules/.pnpm/node_modules; when it did not (e.g. a
Docker build with filtered installs), next build failed with
TS7016 "Could not find a declaration file for module 'react-dom/client'"
and then 'js-yaml'.

Declare the @types packages as optional peers so pnpm links them next to
the SDK whenever the consumer has them. No source change; the lockfile is
unchanged. Bump driver to 1.0.1 and shared to 1.0.4 for release.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@norberia norberia added this to the v5.2 milestone Nov 23, 2026
@norberia
norberia marked this pull request as ready for review November 23, 2026 11:30
@norberia
norberia requested a review from a team as a code owner November 23, 2026 11:30
@cuisongliu
cuisongliu merged commit fe2f81d into main Nov 23, 2026
33 checks passed
@cuisongliu
cuisongliu deleted the fix/driver-sdk-types-peer branch November 23, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants