cssinjs / cssinjs/jss

Type error when using fallbacks array with typescript

Open
#1,596 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.1k
Forks
386
PR merge metrics
No merged PRs in 30d

Description

__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 | Observable | 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.