gridGap property incorrect type
See original GitHub issueBug report
Describe the bug
When trying to use gridGap: theme.space.someSpace
, TypeScript throws error:
Type 'Token<"someSpace", string, "space", "">' is not assignable to type 'Globals | Index | undefined'.
Type 'Token<"someSpace", string, "space", "">' is not assignable to type 'number & Record<never, never>'.
Type 'Token<"someSpace", string, "space", "">' is not assignable to type 'number'.ts(2322)
To workaround, user can use columnGap
+ rowGap
(both work fine).
To Reproduce
See this sandbox: https://codesandbox.io/s/naughty-pond-1rvogt?file=/src/App.tsx
Expected behavior
gridGap
does not throw TS error.
System information
- OS: macOS
- Version of Stitches: 1.2.8
- Version of Node.js: 16
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
gap - CSS: Cascading Style Sheets - MDN Web Docs
The gap CSS property sets the gaps (gutters) between rows and columns. It is a shorthand for row-gap and column-gap.
Read more >gap | CSS-Tricks
The gap property in CSS is a shorthand for row-gap and column-gap , specifying the size of gutters, which is the space between...
Read more >Property 'grid-gap' doesn't exist in CSS - Stack Overflow
Just stumbled upon this problem myself and so logging the answer here. This can be achieved with 'column-gap' and 'row-gap'. Visual studio code ......
Read more >css ( grid-gap is replaced by gap ) · Issue #54688 - GitHub
In the verbage it says " Property is Obsolete. Avoid using it." Well thanks for letting me know, BUT you do not tell...
Read more >Grid Cheatsheet
The three properties grid-template-rows, grid-template-columns, ... size of the grid is not purely the sum of the track sizes, as row-gap, column-gap and ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That seems wierd to me, because in docs there is section with tips for stricter Typescript experience, and using
Token
directly is there as an option.And it works for every other property other than
gridGap
, so it looks like to me this is indeed a bug (or not ideal documentation).I think this isn’t a bug actually. What you get from
theme.space.someSpace
isn’t astring
, but actually aToken
. You can access the value of it using thevalue
property, so that would betheme.space.someSpace.value
.Here is the forked version from your Codesandbox: https://codesandbox.io/s/modulz-stitches-gridgap-property-incorrect-type-1021-forked-05sb6x?file=/src/App.tsx