Files
langgraphjs/examples/chatbots
J3tCh3n 8e2b8584c5 docs: Update customer_support_small_model example to use non-deprecated methods and add type annotations (#1718)
## Description

Updated the `customer_support_small_model.ipynb` example to use
non-deprecated API methods and improve TypeScript type safety.

## Changes

### 1. Replace deprecated `_getType()` method
- **Before**: `if (trimmedHistory.at(-1)._getType() === "ai")`
- **After**: `if (trimmedHistory[trimmedHistory.length - 1].getType()
=== "ai")`
- The `_getType()` method signature is deprecated and should be replaced
with `getType()`
- Also replaced `.at(-1)` with `[trimmedHistory.length - 1]` to fix
TypeScript "possibly undefined" error (ts(2532))

### 2. Add missing type annotation
- **Location**: `addConditionalEdges` callback in `billing_support` node
- **Added**: `async (state: typeof StateAnnotation.State) =>` type
annotation
- Ensures consistency with other conditional edge definitions in the
example

## Type of Change
- [x] Documentation update
- [x] Bug fix (non-breaking change which fixes TypeScript errors)

## Testing
- Verified code changes compile without TypeScript errors
- Confirmed deprecated method warnings are resolved

## Motivation

This PR addresses two issues in the example notebook:

1. **API Deprecation**: The `_getType()` method is deprecated and should
be replaced with the public `getType()` API
2. **TypeScript Safety**: Adding explicit type annotations and using
safer array access patterns improves type safety and prevents potential
runtime errors
2026-06-03 15:44:24 -07:00
..
2025-10-17 16:34:43 -07:00