emotion-js / emotion

👩‍🎤 CSS-in-JS library designed for high performance style composition
https://emotion.sh/
MIT License
17.42k stars 1.11k forks source link

Getting error (in development mode) when using a function (which has a custom toString method) inside css #3061

Open kireerik opened 1 year ago

kireerik commented 1 year ago

Current behavior: I am getting the following error: https://github.com/emotion-js/emotion/blob/f3b268f7c52103979402da919c9c0dd3f9e0e189/packages/serialize/src/index.js#L182-L186

Expected behavior: Getting no error at all.

Environment information:

  I recommend we modify the following line: https://github.com/emotion-js/emotion/blob/f3b268f7c52103979402da919c9c0dd3f9e0e189/packages/serialize/src/index.js#L180

like this for example:

      } else if (process.env.NODE_ENV !== 'production' && interpolation.toString.toString() == 'function toString() { [native code] }') {
kireerik commented 1 year ago

Also it would be nice if objects are stringified as well in case they have a custom (non native code) toString method.

kireerik commented 1 month ago

Seems like this (https://github.com/emotion-js/emotion/issues/3061#issue-1770421291) was resolved recently at least for now.