#11733·langchainjs

当 `strictNullChecks` 设置为 `false` 时,`agent.invoke` 会产生类型错误 (没有重载符合签名)

作者: wbyoung创建于 2026年9月25日更新于 2026年9月26日
标签bug

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'.

内容来源: langchain-ai/langchainjs