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 using a function to customise defaults with the default unit plugin #1444

Open
daanvdberg opened this issue Jan 20, 2021 · 1 comment

Comments

@daanvdberg
Copy link

Expected behavior:
Use the 'jss-plugin-default-unit' to override default units for numeric values in combination with TypeScript.

Describe the bug:
The plugin itself doesn't appear to have any issues but I am receiving TypeScript related errors in my IDE when using a function to define an option for the plugin.

const options = {
    width: val => `${val / 2}px`
}
jss.use(defaultUnit(options));

Source: https://cssinjs.org/jss-plugin-default-unit/?v=v10.5.0#customizing-defaults

I'm not sure if the following is the cause but the two definitions of the Options type do not seem to match:

Codesandbox:
N/A

Versions:

  • react-jss: 10.5.0
  • typescript: 4.0.3
  • OS: Linux
@daanvdberg
Copy link
Author

daanvdberg commented Jan 27, 2021

I'd love to contribute but I'm honestly not sure where to start.

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

No branches or pull requests

2 participants