Skip to content

Store: .select type infinite recursion with complex types #90

@thegu5

Description

@thegu5

Astro Info

n/a (store doesn't rely on astro)

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Creating a store with certain complex types as object properties breaks select's typing.

const appStore = store({
   foo: new Image(), // HTMLImageElement
   bar: 1,
});
// errors
let test = appStore.select("bar");

Another example is with socket.io's Socket (see stackblitz link)

What's the expected result?

Type inference for .select to work correctly

Link to Minimal Reproducible Example

https://stackblitz.com/edit/node-8vhkqfjn?file=index.ts

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions