`agent.invoke` produces type (no overload matches signature) error when `strictNullChecks` is set to `false`
Author: wbyoungCreated Sep 25, 2026Updated Sep 26, 2026
Labelsbug
Checked other resources
- This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
- I added a very descriptive title to this issue.
- I searched the LangChain.js documentation with the integrated search.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain.js rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
mkdir tmp
cd tmp
pnpm init
package="$(cat package.json | jq '.type = "module"')"
echo "${package}" > package.json
pnpm i [email protected] @langchain/[email protected] @langchain/[email protected] [email protected]
cat > tsconfig.json <<EOF
{
"compilerOptions": {
"module": "nodenext",
"strictNullChecks": false,
"skipLibCheck": true
},
"include": ["example.ts"]
}
EOF
cat > example.ts <<EOF
import { ChatGoogle } from '@langchain/google/node'
import { HumanMessage } from '@langchain/core/messages'
import { createDeepAgent, StateBackend } from 'deepagents'
const agent = createDeepAgent({
name: 'my-agent',
model: new ChatGoogle('gemini-3.7-flash', {
platformType: 'gcp',
maxOutputTokens: 2048,
googleAuthOptions: {},
}),
systemPrompt:
'You are an agent who takes nothing seriously and just tells jokes in response to the user.',
})
const run = await agent.streamEvents(
{
messages: [
new HumanMessage('hello'),
],
},
{ version: 'v3' },
)
EOF
./node_modules/.bin/tscError Message and Stack Trace (if applicable)
example.ts:17:3 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '{ messages: [HumanMessage<MessageStructure<MessageToolSet>>]; }' is not assignable to parameter of type 'InvokeStateParameter<DeepAgentTypeConfig<ResponseFormatUndefined, undefined, InteropZodObject, readonly [AgentMiddleware<StateSchema<{ files: ReducedValue<FilesRecord, FilesRecordUpdate>; }>, undefined, unknown, (DynamicStructuredTool<...> | ... 6 more ... | DynamicStructuredTool<...>)[], readonly []>, AgentMiddlewa...'.
Type '{ messages: [HumanMessage<MessageStructure<MessageToolSet>>]; }' is not assignable to type '{ messages: Messages; } & FilterPrivateProps<InferStateSchemaUpdate<{ files: ReducedValue<FilesRecord, FilesRecordUpdate>; }>> & FilterPrivateProps<...> & FilterPrivateProps<...>'.
Type '{ messages: [HumanMessage<MessageStructure<MessageToolSet>>]; }' is not assignable to type 'FilterPrivateProps<InferStateSchemaUpdate<StateSchemaFields>>'.
Property 'messages' is incompatible with index signature.
Type '[HumanMessage<MessageStructure<MessageToolSet>>]' is not assignable to type 'never'.
17 {
~
18 messages: [
~~~~~~~~~~~~~~~
...
20 ],
~~~~~~
21 },
~~~
node_modules/.pnpm/[email protected]_@[email protected]/node_modules/langchain/dist/agents/ReactAgent.d.ts:247:3 - The last overload is declared here.
247 streamEvents(state: InvokeStateParameter<Types>, config?: StreamConfiguration<InferContextInput<Types["Context"] extends AnyAnnotationRoot | InteropZodObject ? Types["Context"] : AnyAnnotationRoot> & InferMiddlewareContextInputs<Types["Middleware"]>, StreamMode | StreamMode[] | undefined, boolean, "text/event-stream" | undefined> & {
~~~~~~~~~~~~
Found 1 error in example.ts:17Description
Trying to get static type checking enabled in a project that has strictNullChecks set to false, but an error is being produced.
Without the strictNullChecks set to false, the static typecheck passes correctly.
System Info
$ cat package.json | grep langchain
"@langchain/core": "1.2.12",
"@langchain/google": "0.2.7",
$ cat /etc/fedora-release
Fedora release 44 (Forty Four)
$ node --version
v22.22.2
$ pnpm --version
10.33.0Source: langchain-ai/langchainjs