claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Claude Code SDK Docs for TS incorrect/outdated parameters

Open brock-statsig opened this issue 4 months ago • 2 comments

Environment

  • Platform (select one):
    • [ ] Other: Claude Code TS SDK
  • Claude CLI version: SDK version 1.0.89, latest as-of posting
  • Operating System: macOS 14.6
  • Terminal: In my case, Cursor

Bug Description

The default quickstart for the Claude Code TS SDK will currently trip some lint errors and not function as described

Steps to Reproduce

  1. npm init -y
  2. npm install -g @anthropic-ai/claude-code
  3. create a new .ts file and copy the code listed here: https://docs.anthropic.com/en/docs/claude-code/sdk#quick-start
  4. Node your-file-name.ts

Expected Behavior

No linter errors, system prompt included successfully

Actual Behavior

Object literal may only specify known properties, and 'systemPrompt' does not exist in type 'Options'.ts(2353) Property 'result' does not exist on type 'SDKResultMessage'.

Fix:

Change line systemPrompt: "You are a legal assistant. Identify risks and suggest improvements.", To . customSystemPrompt: "You are a legal assistant. Identify risks and suggest improvements. ", And if (message.type === "result") { To if (message.type === "result" && message.subtype === "success") { Happy to open a PR on docs to fix this if there is somewhere I can do that 😄

brock-statsig avatar Aug 23 '25 16:08 brock-statsig