System Info
System:
OS: Linux 5.15 (ubuntu)
Node: 26.5.0
pnpm: 11.15.1
npmPackages:
@lynx-js/types: 4.0.0
@lynx-js/react: 0.123.2
@lynx-js/rspeedy: 0.16.2
Details
Lynx 4.0 中 clearTimeout(undefined) 抛出异常:
TypeError: param 0 should be Number
根据 WHATWG HTML Standard:
If handle is not provided, the clearTimeout() method call does nothing.
所有其他 JavaScript 运行时行为一致:
| 运行时 |
clearTimeout(undefined) 行为 |
| Chrome |
no-op |
| Firefox |
no-op |
| Safari |
no-op |
| Node.js |
no-op |
| Deno |
no-op |
| Bun |
no-op |
| Lynx 4.0 |
TypeError |
影响:破坏所有传递可选 timer ID 的第三方库。例如 TanStack Router 的 offerPending 函数:
clearTimeout(session?.[3]); // undefined when session is null
目前需要 patch 每个受影响的库来包裹 clearTimeout 调用。
建议修复:在 clearTimeout 入口加类型守卫:
// pseudo-code
if (!handle || typeof handle !== 'number') return;
Reproduce link
No response
Reproduce Steps
- 在 Lynx 4.0 环境中执行:
- 观察:抛出
TypeError: param 0 should be Number
- 期望:无操作(no-op)
System Info
System:
OS: Linux 5.15 (ubuntu)
Node: 26.5.0
pnpm: 11.15.1
npmPackages:
@lynx-js/types: 4.0.0
@lynx-js/react: 0.123.2
@lynx-js/rspeedy: 0.16.2
Details
Lynx 4.0 中
clearTimeout(undefined)抛出异常:根据 WHATWG HTML Standard:
所有其他 JavaScript 运行时行为一致:
clearTimeout(undefined)行为影响:破坏所有传递可选 timer ID 的第三方库。例如 TanStack Router 的
offerPending函数:目前需要 patch 每个受影响的库来包裹
clearTimeout调用。建议修复:在
clearTimeout入口加类型守卫:Reproduce link
No response
Reproduce Steps
TypeError: param 0 should be Number