question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BoxShadow does not support TLength generic

See original GitHub issue

In many CSS-in-JS solutions the following declaration of box-shadow is allowed:

boxShadow: [5, 5, 10, '#000']

For example we’re using custom generics to support such values. However CSS.Property.BoxShadow does not come with support for generics, so it’ll ignore the passed TLength type property.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
freniccommented, Sep 20, 2021

This would solve that:

type ValueTypes = string | number | boolean | (string | number | boolean)[];

type CustomProperyNames = 'boxShadow';

type CustomProperties = {
  [property in keyof Pick<CSS.PropertiesFallback, CustomProperyNames>]: CSS.PropertiesFallback[property] | ValueTypes;
};

interface Props extends Omit<CSS.PropertiesFallback<ValueTypes>, keyof CustomProperties>, CustomProperties {}

const style: Props = {
  boxShadow: [1, 2, 3, '#000'], // OK 👌
};
0reactions
freniccommented, Sep 20, 2021

Thanks for offering a donation but this one’s on me 🙂 Happy it worked!

Read more comments on GitHub >

github_iconTop Results From Across the Web

box-shadow - CSS: Cascading Style Sheets - MDN Web Docs
The box-shadow CSS property adds shadow effects around an element's frame. You can set multiple effects separated by commas. A box shadow is...
Read more >
Box-shadow not showing - Stack Overflow
I have been working on this for a full day and couldn't find a solution. I removed the background image and was still...
Read more >
box-shadow does not work - WordPress.org
[This thread is closed.] hello, I am creating a theme 100% AMP compatible, I validate it with https://validator.ampproject.org/ and everything is ok.…
Read more >
CSS3 Box-shadow | Can I use... Support tables for ... - CanIUse
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
Smoother & sharper shadows with layered box-shadows
With a simple CSS trick, we can get fine-tuned control over how shadows are rendered, and create richer and more realistic 3D effects....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found