cssinjs / jss

JSS is an authoring tool for CSS which uses JavaScript as a host language.
https://cssinjs.org
MIT License
7.06k stars 397 forks source link

TS error using a function to customise defaults with the default unit plugin #1444

Open daanvdberg opened 3 years ago

daanvdberg commented 3 years ago

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:

daanvdberg commented 3 years ago

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