Skip to content

Bug(docs, typing): session.prompt(timeout?) 和 session.prompt(callback, options?) 的返回值应可能为 null 或 undefined #1516

@FurryR

Description

@FurryR

Describe the bug

See https://koishi.chat/zh-CN/api/core/session.html#session-prompt-1

Steps to reproduce

N/A

Expected behavior

考虑到超时会导致其返回 null 或 undefined,应当在 Promise 内加入 | null| undefined 来表示可能为空的值。(被 timeout 坑到了

同时,

如果回调函数返回值非空,则下一次输入不会进入中间件处理流程。

这里的描述有点模糊了。如果回调函数返回 nullundefined 甚至 document.all,这三种情况是否会进入中间件处理流程?

Screenshots

N/A

Versions

N/A

Additional context

可能为 breaking change,需要将修复的发版推迟到下一个 minor/major。
无论如何不应在 timeout 时抛出异常(成本过于高昂/timeout 也是一个 expected case)。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBUGdocs文档相关

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions