Skip to content

type of reactive collection values is not unrefed #5954

Open
@FerricIon

Description

@FerricIon

Link to minimal reproduction

https://codesandbox.io/s/gallant-glade-l6n6g5?file=/src/index.ts

Steps to reproduce

Comment line 5 and uncomment line 6 and there will be a typescript error indicating typeof m is Map<string, { a: Ref<number> }>, same for line 7 and line 8, line 14 and line 15, line 16 and line 17.

From the output, we know that values got from m.get is actually { a: number }, which is inconsistent with the typing.

What is expected?

typeof reactive(new Set<{ a: Ref<number> }()) is Set<{ a: Ref<number> }> so we can use .a.value or is Set<{ a: number }> so we can use .a on set items.

What is actually happening?

typeof reactive(new Set<{ a: Ref<number> }>()) is inferred as Set<{ a: Ref<number> }> but is actually Set<{ a: number }>. Same for Map.

System Info

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions