`@effect/ui-native` (Effect-TS/ui): `kit/VirtualList` `list` part widens `R` to `any`, poisoning enclosing components

未关闭
#11,097 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@effect-bot 已经在做这个了。

开始于 2026年11月29日。

评估

这个 Issue 还没有评估数据。

描述

partially generated with help of my ai friend - neon 4.4

Hi effect team,
I was trying out this package and wanted to report some bugs encountered while porting a library to effect native

What version of Effect is running?
  • effect: 4.1.7
  • @effect/ui & @effect/ui-native: Effect-TS/ui main at 77391ee50ae3d3175d670facbf675e9a819ba6a6
  • react-native: 0.88.1
  • typescript: 5.9.3 (strict: true, exactOptionalPropertyTypes: true)
What steps can reproduce the bug?
  1. Clone the minimal reproduction repository:
    git clone https://github.com/cliffordfajardo/effectui-native-error-reproductions.git
    cd effectui-native-error-reproductions
    pnpm install
    pnpm vitest run 11-virtuallist-part-leaks-any-requirements
    
  2. Render VirtualList inside any Native.component and inspect Component.Requirements<typeof VirtualList> and Component.Requirements<typeof WithVirtualList> (see 11-virtuallist-part-leaks-any-requirements/repro.test.ts).
What is the expected behavior?

VirtualList's list part should preserve R = never (View.Part<"scroll", [], never>), so Component.Requirements<typeof VirtualList> is never and any parent component rendering VirtualList preserves its exact service requirements R.

What do you see instead?

In dist/kit/VirtualList.d.ts:153,158, list is inferred as View.Part<"scroll", [], any> and VirtualList itself has R = any:

list: View.Part<"scroll", [], any>;
...
}, any, never, never, never, never, never>;

This happens in packages/ui-native/src/kit/VirtualList.ts:678-744, where withSpacers returns ReadonlyArray<View.Node<any, any>> and .forward(...) returns { ...built, children: withSpacers(built.children, owner) }, widening the forwarded node's R to any.

As a result, any component that renders VirtualList:

  1. Has its Component.Requirements silently poisoned to any (erasing missing Effect service requirement checks).
  2. Fails strict entrypoint typechecks (e.g., Effect.runPromise / NativeApp.mount under exactOptionalPropertyTypes: true) unless callers manually cast VirtualList(...) back to R = never.
Additional information

Preserving built's type (e.g., typing withSpacers generically over <Msg, R> or casting the returned children back to typeof built.children) prevents any from leaking into list and VirtualList's R parameter.

主要语言
TypeScript
星标
16.7k
派生
808
平均合并
21 小时 22 分钟
30 天内合并 PR
486

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Effect-TS/effect 的其他 Issue

查看 Effect-TS/effect 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。