johanholmerin / style9

CSS-in-JS compiler inspired by Meta's stylex
MIT License
570 stars 27 forks source link

Export `StyleWithAtRules` type #59

Closed SukkaW closed 2 years ago

SukkaW commented 2 years ago

I am using in React component level based style composition:

import style9 from 'style9';

const styles = style9.create({
  base: { /* */ }
});

export const SomeComponent = (props: {
  $style?: // How to type this?
}) => (
  <div classNames={style9(styles.base, props.$style)} />
);
const styles = style9.create({
  extend: { /* */ }
});

<SomeComponent $style={styles.extend} />

With StyleWithAtRules being exported, I can type SomeComponent like this:

import style9, { type StyleWithAtRules } from 'style9';

export const SomeComponent = (props: {
  $style?: StyleWithAtRules
}) => (
  <div classNames={style9(styles.base, props.$style)} />
);
johanholmerin commented 2 years ago

Released in 0.11.0