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

TS: Error with @font-face and @import rules in globalCss function #803

Closed
mateuszaliyev opened this issue Sep 18, 2021 · 0 comments · Fixed by #809
Closed

TS: Error with @font-face and @import rules in globalCss function #803

mateuszaliyev opened this issue Sep 18, 2021 · 0 comments · Fixed by #809
Labels
P1 typescript TypeScript related

Comments

@mateuszaliyev
Copy link
Contributor

Bug report

Describe the bug

Using @font-face and @import rules in globalCss function results in type errors.

To Reproduce

https://codesandbox.io/s/withered-meadow-j4hcj

Expected behavior

No type errors as it used to be in previous releases.

System information

  • OS: Windows 10
  • Version of Stitches: 1.2.0
  • Version of Node.js: 15.14.0

Additional context

I stumbled upon this error while working on my Next.js project after updating from v1.1.0 to v1.2.0. I've managed to reproduce the error using Code Sandbox with React TypeScript template. I'm pretty sure the bug is related to changes made in #793 though those type definitions are too complex for me to come up with a fix.

Error message produced by TypeScript is quite long. There are two sentences that stand out in my opinion:

Property '"@font-face"' is incompatible with index signature.
Types of property 'filter' are incompatible.

With @import rule both string and string[] values result in type errors whereas @font-face rule only produces an error with array of objects. Additionally hovering over @font-face key in VSCode shows that it is of type unknown while I believe it should actually be AtRule.FontFace | AtRule.FontFace[].

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

Successfully merging a pull request may close this issue.

2 participants