cssinjs / jss

JSS is an authoring tool for CSS which uses JavaScript as a host language.
https://cssinjs.org
MIT License
7.08k stars 399 forks source link

Types of parameters '__0' and 'data' are incompatible #1516

Closed ayush3899 closed 3 years ago

ayush3899 commented 3 years ago
Argument of type '(theme: { colors: { White: string; Black: string; DGrey: string; LGrey: string; BorderCol: string; GreyBG: string; Blue: string; DodgerBlue: string; DBlue: string; Green: string; DGreen: string; Yellow: string; ... 4 more ...; golden: string; }; screenSizes: { ...; }; }) => { ...; }' is not assignable to parameter of type 'Record<"button" | "link" | "slimRound", string | Observable<string | { alignContent?: (string & {}) | ... | { [K: string]: false | (string & {}) | (number & {}) | (string | number | (string | number)[])[] | ... | ... | Observable<...> | ((data: any) => false | ... 4 more ... | { ...; }); } | ... 17 more ... | ((data...'.
  Type '(theme: { colors: { White: string; Black: string; DGrey: string; LGrey: string; BorderCol: string; GreyBG: string; Blue: string; DodgerBlue: string; DBlue: string; Green: string; DGreen: string; Yellow: string; ... 4 more ...; golden: string; }; screenSizes: { ...; }; }) => { ...; }' is not assignable to type '(theme: { colors: { White: string; Black: string; DGrey: string; LGrey: string; BorderCol: string; GreyBG: string; Blue: string; DodgerBlue: string; DBlue: string; Green: string; DGreen: string; Yellow: string; ... 4 more ...; golden: string; }; screenSizes: { ...; }; }) => Record<...>'.
    Call signature return types '{ button: { background: ({ isSecondary }: { isSecondary: any; }) => string; color: ({ isSecondary }: { isSecondary: any; }) => string; border: ({ isSecondary }: { isSecondary: any; }) => string; fontSize: ({ fontSize }: { fontSize: any; }) => any; ... 6 more ...; opacity: ({ disable }: { ...; }) => 0.4 | 1; }; link:...' and 'Record<"button" | "link" | "slimRound", string | Observable<string | { alignContent?: (string & {}) | ... | { [K: string]: false | (string & {}) | (number & {}) | (string | number | (string | number)[])[] | ... | ... | Observable<...> | ((data: any) => false | ... 4 more ... | { ...; }); } | ... 17 more ... | ((data...' are incompatible.
      The types of 'button' are incompatible between these types.
        Type '{ background: ({ isSecondary }: { isSecondary: any; }) => string; color: ({ isSecondary }: { isSecondary: any; }) => string; border: ({ isSecondary }: { isSecondary: any; }) => string; fontSize: ({ fontSize }: { fontSize: any; }) => any; padding: string; ... 5 more ...; opacity: ({ disable }: { ...; }) => 0.4 | 1; }' is not assignable to type 'string | Observable<string | { alignContent?: (string & {}) | ... | { [K: string]: false | (string & {}) | (number & {}) | (string | number | (string | number)[])[] | ... | ... | Observable<false | (string & {}) | (number & {}) | (string | ... 1 more ... | (string | number)[])[] | ... | ...> | ((data: any) => false ...'.
          Type '{ background: ({ isSecondary }: { isSecondary: any; }) => string; color: ({ isSecondary }: { isSecondary: any; }) => string; border: ({ isSecondary }: { isSecondary: any; }) => string; fontSize: ({ fontSize }: { fontSize: any; }) => any; padding: string; ... 5 more ...; opacity: ({ disable }: { ...; }) => 0.4 | 1; }' is not assignable to type '{ [K: string]: false | (string & {}) | (number & {}) | (string | number | (string | number)[])[] | Observable<false | (string & {}) | (number & {}) | (string | number | (string | number)[])[] | { alignContent?: (string & {}) | ... 19 more ... | ((data: any) => (string & {}) | ... 17 more ... | "normal"); ... 782 mor...'.
            Property 'background' is incompatible with index signature.
              Type '({ isSecondary }: { isSecondary: any; }) => string' is not assignable to type 'false | (string & {}) | (number & {}) | (string | number | (string | number)[])[] | Observable<false | (string & {}) | (number & {}) | (string | number | (string | number)[])[] | { alignContent?: (string & {}) | ... 19 more ... | ((data: any) => (string & {}) | ... 17 more ... | "normal"); ... 782 more ...; vectorEf...'.
                Type '({ isSecondary }: { isSecondary: any; }) => string' is not assignable to type '(data: unknown) => false | (string & {}) | (number & {}) | (string | number | (string | number)[])[] | { alignContent?: (string & {}) | ... | { [K: string]: false | (string & {}) | (number & {}) | (string | number | (string | number)[])[] | ... | ... | Observable<...> | ((data: undefined) => false | ... 4 more ... |...'.
                  Types of parameters '__0' and 'data' are incompatible.
                    Property 'isSecondary' is missing in type '{}' but required in type '{ isSecondary: any; }'.  TS2345

    17 | }
    18 | 
  > 19 | const useStyle = createUseStyles((theme: Theme) => ({
       |                                  ^
    20 |   button: {
    21 |     background: ({ isSecondary }) =>
    22 |       isSecondary ? theme.colors.White : theme.colors.Blue,

I am getting this error again and again. MacOS: catalina Node: 14.x.x {stable} jss: latest

What the issue here I can't understand. Is it a typeScript error or JSS?

kof commented 3 years ago

Closing because no reproducible example.