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

Type error when using fallbacks array with typescript #1596

Open
paul0lden opened this issue Feb 4, 2022 · 1 comment
Open

Type error when using fallbacks array with typescript #1596

paul0lden opened this issue Feb 4, 2022 · 1 comment

Comments

@paul0lden
Copy link

Expected behavior:
Fallbacks array with typescript styles

Describe the bug:
Using fallbacks array in style object with typescript leads to an error. If I'm using fallbacks as an object it works just fine. Also the style compiles successfully, but the typerror may lead to the pipeline fails and other messy things.

Type '{ width: string; }[]' is not assignable to type 'JssValue | JssStyle<any, undefined> | Observable<JssValue | JssStyle<any, undefined> | undefined> | ((data: any) => JssValue | ... 1 more ... | undefined)'. Type '{ width: string; }[]' is not assignable to type '(string | number | (string | number)[])[]'. Type '{ width: string; }' is not assignable to type 'string | number | (string | number)[]'. Object literal may only specify known properties, and 'width' does not exist in type '(string | number)[]'.ts(2322)

Reproduction:
https://codesandbox.io/s/jss-typescript-react-test-forked-lq0sm?file=/src/styles.ts

Versions (please complete the following information):

  • jss: 10.6.0
  • Browser [e.g. chrome, safari]: chorme/firefox
  • OS [e.g. Windows, macOS]: macOS
    Feel free to add any additional versions which you may think are relevant to the bug.
@gabrielferreira-cit
Copy link

I still have the same issue on version 10.9.0, even though it's over a year old. Do you happen to have any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants