cssinjs / cssinjs/jss

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

Open
#1,407 1 comment 0 reactions 0 assignees View on GitHub
help wanted typescript
Dominant language
JavaScript
Stars
7.1k
Forks
386
PR merge metrics
No merged PRs in 30d

Description

__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, options?: Pick, "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.

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.