Fix typescript samples in documentation#610
Open
horihiro wants to merge 6 commits intogithub:mainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes TypeScript documentation samples across the Node.js SDK to work correctly with version 0.1.29+ of the library, where onPermissionRequest became a required parameter in SessionConfig and ResumeSessionConfig. It also updates the Node.js version requirement in the getting-started guide to reflect the minimum needed for node:sqlite support.
Changes:
- Add
onPermissionRequest: async () => ({ kind: "approved" })to all TypeScriptcreateSession()andresumeSession()call sites across docs and examples - Update Node.js version requirement in
docs/getting-started.mdfrom18+to22.13.0+ / 23.5.0+ / 24+ - Update function signatures
createSession(config?: SessionConfig)→createSession(config: SessionConfig)andresumeSession(sessionId, config?)→resumeSession(sessionId, config)to reflect that config is now required
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
nodejs/examples/basic-example.ts |
Adds onPermissionRequest to the example createSession call |
nodejs/README.md |
Updates function signatures, adds onPermissionRequest to all code samples and config docs |
docs/getting-started.md |
Updates Node.js version requirement; adds onPermissionRequest to TypeScript samples |
docs/mcp/overview.md |
Adds onPermissionRequest to TypeScript createSession calls |
docs/hooks/user-prompt-submitted.md |
Adds onPermissionRequest to all TypeScript samples; removes trailing whitespace |
docs/hooks/session-lifecycle.md |
Adds onPermissionRequest to all TypeScript samples; removes trailing whitespace |
docs/hooks/pre-tool-use.md |
Adds onPermissionRequest to all TypeScript samples; removes trailing whitespace |
docs/hooks/post-tool-use.md |
Adds onPermissionRequest to all TypeScript samples; removes trailing whitespace |
docs/hooks/overview.md |
Adds onPermissionRequest to TypeScript samples |
docs/hooks/error-handling.md |
Adds onPermissionRequest to all TypeScript samples; removes trailing whitespace |
docs/guides/skills.md |
Adds onPermissionRequest to the createSession call with disabledSkills |
docs/guides/setup/scaling.md |
Adds onPermissionRequest to createSession and resumeSession calls |
docs/guides/setup/local-cli.md |
Adds onPermissionRequest to both createSession and resumeSession calls |
docs/guides/setup/github-oauth.md |
Adds onPermissionRequest to the session creation example |
docs/guides/setup/byok.md |
Adds onPermissionRequest to all createSession and resumeSession samples |
docs/guides/setup/bundled-cli.md |
Adds onPermissionRequest to createSession and resumeSession samples |
docs/guides/setup/backend-services.md |
Adds onPermissionRequest to all session creation/resumption calls |
docs/guides/setup/azure-managed-identity.md |
Adds onPermissionRequest to the TypeScript createSession example |
docs/guides/session-persistence.md |
Adds onPermissionRequest to createSession and resumeSession samples; removes trailing whitespace |
docs/debugging.md |
Adds onPermissionRequest to the createSession snippet; removes trailing whitespace |
docs/compatibility.md |
Adds onPermissionRequest to the context compaction example |
docs/auth/byok.md |
Adds onPermissionRequest to BYOK session examples |
patniko
previously approved these changes
Feb 28, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Add
onPermissionRequestto parameters ofcreateSessionandresumeSessionAs of
0.1.29,onPermissionRequestis required inSessionConfig, socreateSessionandresumeSessionthrow an exception when the parameter isnullorundefined.Update Node.js version
When
createSessionis executed, GitHub Copilot CLI (or SDK? not sure.) seems to try to loadnode:sqliteand usesqlite.constants.They are available in
22.13.0+ / 23.5.0+ / 24+