cssinjs/jss

Jss-plugin-template & Typescript - Can't type the style root

Open

#1,407 建立於 2020年10月11日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)JavaScript (7,000 star) (434 fork)batch import
help wantedtypescript

描述

Expected behavior: I think that I have to code the following types that the error gives in the root tag:

Describe the bug:

No overload matches this call.
  Overload 1 of 2, '(style: Styles<Theme, {}, "root">, options?: Pick<WithStylesOptions<Theme>, "flip" | "element" | "defaultTheme" | "name" | "media" | "meta" | "index" | "link" | "generateId" | "classNamePrefix">): (props?: any) => Record<...>', gave the following error.
  Type 'string' is not assignable to type 'CSSProperties | CreateCSSProperties<{}> | PropsFunc<{}, CreateCSSProperties<{}>>'

The problem is that I just don't know how to do it, never typed anything like this before in other projects. Can you explain it to me, please? You can find the code here:

Codesandbox link: https://codesandbox.io/s/github/pedroRelvas/HowToTypeTheStyleRoot (You can find the error on the file demo.tsx).

Versions (please complete the following information): -jss: "^10.4.0", -jss-plugin-template: "^10.4.0",

  • Browser [e.g. chrome, safari]: Chrome - 86.0.4240.75 (Compilação oficial) (64 bits)
  • OS [e.g. Windows, macOS]: Windows 10 Feel free to add any additional versions which you may think are relevant to the bug.

貢獻者指南