Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[forest] classList typings error with Array<Store<string>> as value #965

Open
pijng opened this issue Aug 29, 2023 · 0 comments
Open

[forest] classList typings error with Array<Store<string>> as value #965

pijng opened this issue Aug 29, 2023 · 0 comments
Labels
bug Something isn't working forest forest package typings Typescript public type definitions issues

Comments

@pijng
Copy link

pijng commented Aug 29, 2023

What is the current behavior:

If you specify Array<Store<string>> as the value for classList, typescript will show an error:

Type 'Store<string>' is not assignable to type 'string | Store<string | null>'.
  Type 'Store<string>' is not assignable to type 'Store<string | null>'.
    Types of property 'updates' are incompatible.
      Type 'Event<string>' is not assignable to type 'Event<string | null>'.
        Types of parameters 'payload' and 'payload' are incompatible.
          Type 'string | null' is not assignable to type 'string'.
            Type 'null' is not assignable to type 'string'.(2322)

Please provide the steps to reproduce and if possible a minimal demo of the problem via https://share.effector.dev, https://codesandbox.io or similar

Minimal reproduce:
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbwMZQKYEMaoMo2qgXzgDMoIQ4AiVY41JPKSgKFElkQFcBnYAOwDmAGjgALEdzD0ipclWL5uMFsx78BACgAmEJJxCo+MAHQBHTqigBPbKgA29RhsoAjCFquUAlAEIRGrzgAXgA+RGY4OCQIPiU4ABIkO3RubmCotEwcRlRnMBcAWgAWb2YIsWd0Sn9A0PDIyMl6DQRyhqjk1IAZYCUALjgAbUTO7gBdNrgCL3Lp5mmgA

What is the expected behavior:

As far as I can tell, there should be support for such cases at type level:

export type ClassListArray = Array<Store<string | null> | string>

Which versions of effector packages, and which browser and OS are affected by this issue? Did this work in previous versions of effector?:

"forest": "^0.21.2",
"effector": "^22.8.6"
@pijng pijng added bug Something isn't working needs triage labels Aug 29, 2023
@pijng pijng changed the title [forest] classList error with Array<Store<string>> as value [forest] classList typings error with Array<Store<string>> as value Aug 29, 2023
@sergeysova sergeysova added typings Typescript public type definitions issues forest forest package and removed needs triage labels Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forest forest package typings Typescript public type definitions issues
Projects
None yet
Development

No branches or pull requests

2 participants