chore: Drop unnecessary createTracker non-null assertions in getting-started examples#1380
Merged
Merged
Conversation
LDAIConfig.createTracker is declared non-optional in src/api/config/types.ts, so the `!` is unnecessary across the three getting-started examples. Refs AIC-2383 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7df2ac8 to
c2ff6ba
Compare
Contributor
|
@launchdarkly/js-sdk-common size report |
Contributor
|
@launchdarkly/js-client-sdk-common size report |
Contributor
|
@launchdarkly/js-client-sdk size report |
Contributor
|
@launchdarkly/browser size report |
keelerm84
approved these changes
May 14, 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
LDAIConfig.createTrackeris declared non-optional inpackages/sdk/server-ai/src/api/config/types.ts, so the!non-null assertion is unnecessary. Drop it across the threegetting-started/examples that still had it.Affected files:
packages/sdk/server-ai/examples/getting-started/bedrock/converse/src/index.tspackages/sdk/server-ai/examples/getting-started/openai/chat-completions/src/index.tspackages/sdk/server-ai/examples/getting-started/vercel-ai/generate-text/src/index.tsBackground
This PR was originally scoped against the pre-#1379 examples layout (with
examples/openai/,examples/bedrock/,examples/openai-observability/,examples/direct-judge/, etc.). PR #1379 ("Align server-ai examples with EXAM-SDK-example spec") restructured the examples intofeatures/andgetting-started/subdirectories and absorbed most of the issues this PR originally targeted — including theOpenAIProviderclass removal,aiConfig.trackerproperty usage,LDAIMetrics(usage:)literal, andtrackSuccess({...})arg bug. ThreecreateTracker!()occurrences remain in the newgetting-started/examples; those are what this PR now fixes.Refs AIC-2383. This PR is part of the AI Configs docs/example modernization sweep tracked in `python-agent-work/all-docs-review.md`.
Test plan
🤖 Generated with Claude Code
Note
Low Risk
Low risk: changes are limited to TypeScript getting-started examples and only remove
!non-null assertions fromaiConfig.createTracker, with no runtime behavior change expected.Overview
Cleans up the
server-aigetting-started examples to callaiConfig.createTracker()directly (without the!non-null assertion) in the Bedrock converse, OpenAI chat-completions, and Vercel AI generate-text samples.This aligns the examples with the SDK typings where
createTrackeris non-optional and avoids masking potential type issues.Reviewed by Cursor Bugbot for commit c2ff6ba. Bugbot is set up for automated code reviews on this repo. Configure here.