LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • Types
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
  • Vitest
⌘I

Chat LangChain

What can I help with?

Enter to send·Shift+Enter new line

Menu

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsutilsDeferredthen
Method●Since v1.12

then

Attaches callbacks for the resolution and/or rejection of the Promise.

Copy
then<
  TResult1 = T,
  TResult2 = never
>(
  onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1> | null, onrejected: (reason: unknown) => TResult2 | PromiseLike<TResult2> | null
): Promise<TResult1 | TResult2>

Parameters

NameTypeDescription
onfulfilled(value: T) => TResult1 | PromiseLike<TResult1> | null

The callback to execute when the Promise is resolved.

onrejected(reason: unknown) => TResult2 | PromiseLike<TResult2> | null

The callback to execute when the Promise is rejected.

View source on GitHub