Repository navigation
fix(sdk): declare type peers for TS-source driver and shared packages - #7458
Merged
Merged
Conversation
@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>
cuisongliu
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 duringnext build. Both import modules whose type declarations come from@types/*packages that were only listed asdevDependencies:react-dom/client(src/popover.tsx)@types/react-dom(also uses@types/react)js-yaml(src-server/config/reader.ts),react@types/js-yaml,@types/reactdevDependenciesare not installed for consumers, so TypeScript only finds these declarations if pnpm happens to hoist them intonode_modules/.pnpm/node_modules. When it doesn't, consumer builds fail with TS7016, e.g. in sealos-apps/databaserelease-v5.2:and, once that is fixed, the same error for
js-yamlin@labring/sealos-shared-sdk/src-server/config/reader.ts.Change
@types/reactand@types/react-dom(^18.0 || ^19.0), bump to1.0.1.@types/js-yaml(^4) and@types/react(^18.0 || ^19.0), bump to1.0.4.With the peers declared, pnpm links the consumer's
@typespackages 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.yamlis unchanged (pnpm install --lockfile-onlywith pnpm 8.9.0 produces no diff).Test plan
pnpm install --frozen-lockfile(pnpm 8.9.0) succeeds; lockfile unchangedtsc --noEmit; sharedpnpm typecheckandpnpm lint; desktop (the in-repo consumer)tsc --noEmitandnext lint(pre-existing warnings only)frontend/scripts/prepare-npm-packages.mjs+npm pack): file lists andsrc/contents identical to the publishedsealos-driver-sdk@1.0.0/sealos-shared-sdk@1.0.3; manifests differ only in version and the new peer fieldsrelease-v5.2, unmodified Dockerfile, SDKs overridden to the candidate tarballs): with the published versions the build fails with thereact-dom/clienterror; with the candidates both SDK type errors are gone and type-checking passes@labring/sealos-driver-sdk@1.0.1and@labring/sealos-shared-sdk@1.0.4Generated with Devin