openclaw - ✅(Solved) Fix [Bug]: pnpm build fails at build:plugin-sdk:dts (5 TS2322 errors) [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62279Fetched 2026-04-08 03:06:46
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
closed ×1cross-referenced ×1

pnpm build fails during build:plugin-sdk:dts (tsc -p tsconfig.plugin-sdk.dts.json) with five TypeScript errors in three files.

Error Message

  1. src/gateway/client.ts (~line 237): checkServerIdentity is typed as returning boolean on ClientOptions, but the implementation returns Error | undefined (TS2322). src/agents/tools/music-generate-tool.actions.ts:90:5 - error TS2322: Type '(sessionKey?: string | undefined) => TaskRecord | null' is not assignable to type '(sessionKey?: string | undefined) => TaskRecord | undefined'.

Root Cause

pnpm build fails during build:plugin-sdk:dts (tsc -p tsconfig.plugin-sdk.dts.json) with five TypeScript errors in three files.

Fix Action

Fixed

PR fix notes

PR #62283: Build: fix plugin-sdk dts TS errors (media tools + gateway TLS)

Description (problem / solution / changelog)

Summary

Fixes https://github.com/openclaw/openclaw/issues/62279

  • Media generate tools: findActiveMusicGenerationTaskForSession / findActiveVideoGenerationTaskForSession return null, but createMediaGenerate* expects undefined. Wrap with ?? undefined at the call site.
  • Gateway client: ws ClientOptions["checkServerIdentity"] is typed to return boolean. Return booleans and stash a concrete Error for onConnectError when the TLS handshake fails (fingerprint missing / unavailable / mismatch).

Test plan

  • pnpm build:plugin-sdk:dts
  • pnpm build

Made with Cursor

Changed files

  • src/agents/tools/music-generate-tool.actions.ts (modified, +6/-2)
  • src/agents/tools/video-generate-tool.actions.ts (modified, +6/-2)
  • src/gateway/client.ts (modified, +16/-5)

Code Example

> openclaw@2026.4.6 build:plugin-sdk:dts /Users/luo/work/GitHub/openclaw
> tsc -p tsconfig.plugin-sdk.dts.json

src/agents/tools/music-generate-tool.actions.ts:90:5 - error TS2322: Type '(sessionKey?: string | undefined) => TaskRecord | null' is not assignable to type '(sessionKey?: string | undefined) => TaskRecord | undefined'.
  Type 'TaskRecord | null' is not assignable to type 'TaskRecord | undefined'.
    Type 'null' is not assignable to type 'TaskRecord | undefined'.

90     findActiveTask: findActiveMusicGenerationTaskForSession,
       ~~~~~~~~~~~~~~

  src/agents/tools/media-generate-tool-actions-shared.ts:13:3
    13   findActiveTask: (sessionKey?: string) => Task | undefined;
         ~~~~~~~~~~~~~~

[... additional TS2322 errors in music-generate-tool.actions.ts, video-generate-tool.actions.ts, gateway/client.ts ...]

Found 5 errors in 3 files.
ELIFECYCLECommand failed with exit code 1.
RAW_BUFFERClick to expand / collapse

Summary

pnpm build fails during build:plugin-sdk:dts (tsc -p tsconfig.plugin-sdk.dts.json) with five TypeScript errors in three files.

Steps to reproduce

  1. Clone the repo and install dependencies (pnpm install).
  2. Run pnpm build.
  3. Observe failure at pnpm build:plugin-sdk:dts.

Expected behavior

pnpm build completes successfully, including build:plugin-sdk:dts.

Actual behavior

TypeScript reports:

  1. src/agents/tools/music-generate-tool.actions.ts (lines ~90, ~101): findActiveMusicGenerationTaskForSession returns TaskRecord | null but createMediaGenerateStatusActionResult / createMediaGenerateDuplicateGuardResult expect findActiveTask to return Task | undefined (TS2322).

  2. src/agents/tools/video-generate-tool.actions.ts (lines ~94, ~105): Same mismatch for findActiveVideoGenerationTaskForSession (TS2322).

  3. src/gateway/client.ts (~line 237): checkServerIdentity is typed as returning boolean on ClientOptions, but the implementation returns Error | undefined (TS2322).

Environment

  • OpenClaw version: 2026.4.6 (from package.json / CLI output)
  • Command: pnpm build (fails at build:plugin-sdk:dts; user also interrupted one run with Ctrl+C during the same step)

Full log (first failure)

> [email protected] build:plugin-sdk:dts /Users/luo/work/GitHub/openclaw
> tsc -p tsconfig.plugin-sdk.dts.json

src/agents/tools/music-generate-tool.actions.ts:90:5 - error TS2322: Type '(sessionKey?: string | undefined) => TaskRecord | null' is not assignable to type '(sessionKey?: string | undefined) => TaskRecord | undefined'.
  Type 'TaskRecord | null' is not assignable to type 'TaskRecord | undefined'.
    Type 'null' is not assignable to type 'TaskRecord | undefined'.

90     findActiveTask: findActiveMusicGenerationTaskForSession,
       ~~~~~~~~~~~~~~

  src/agents/tools/media-generate-tool-actions-shared.ts:13:3
    13   findActiveTask: (sessionKey?: string) => Task | undefined;
         ~~~~~~~~~~~~~~

[... additional TS2322 errors in music-generate-tool.actions.ts, video-generate-tool.actions.ts, gateway/client.ts ...]

Found 5 errors in 3 files.
 ELIFECYCLE  Command failed with exit code 1.

extent analysis

TL;DR

Update the return types of findActiveMusicGenerationTaskForSession, findActiveVideoGenerationTaskForSession, and checkServerIdentity to match the expected types.

Guidance

  • Review the TypeScript errors and identify the functions with return type mismatches: findActiveMusicGenerationTaskForSession, findActiveVideoGenerationTaskForSession, and checkServerIdentity.
  • Update the return types of these functions to match the expected types: Task | undefined for findActiveMusicGenerationTaskForSession and findActiveVideoGenerationTaskForSession, and boolean for checkServerIdentity.
  • Verify that the updated return types resolve the TypeScript errors by re-running pnpm build.
  • If the errors persist, review the function implementations to ensure they are correctly handling null or undefined values.

Example

// Before
function findActiveMusicGenerationTaskForSession(sessionKey?: string): TaskRecord | null {
  // implementation
}

// After
function findActiveMusicGenerationTaskForSession(sessionKey?: string): TaskRecord | undefined {
  // implementation
  // Return undefined instead of null when no task is found
  return task ? task : undefined;
}

Notes

The provided solution assumes that the return type mismatches are the root cause of the TypeScript errors. If the errors persist after updating the return types, further investigation may be necessary to identify the underlying issue.

Recommendation

Apply the workaround by updating the return types of the affected functions to match the expected types. This should resolve the TypeScript errors and allow pnpm build to complete successfully.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

pnpm build completes successfully, including build:plugin-sdk:dts.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING