Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Export
CSSPseudos, CSSProperties, StrictCSSProperties
types for a s…
…trict `XCSSProp` implementation. (#1600) * Export `CSSPseudos, CSSProperties, StrictCSSProperties` types for a strict `XCSSProp` implementation. To avoid the complexity of requiring `ReturnType<typeof XCSSProp<…>>` when creating a `createStrictAPI().XCSSProp` and `props.xcss` implementation, being able to use these types in generics are helpful. The example usage is: ```tsx const { XCSSProp, css, cssMap, cx } = createStrictAPI<…>(); export type StrictXCSSProp< TAllowedProperties extends keyof StrictCSSProperties, TAllowedPseudos extends CSSPseudos, TRequiredProperties extends { requiredProperties: TAllowedProperties; requiredPseudos: TAllowedPseudos; } = never, > = ReturnType< typeof XCSSProp<TAllowedProperties, TAllowedPseudos, TRequiredProperties> >; ``` Then this becomes a bit easier of a type to understand: ```diff -export const Component = ({ xcss }: { xcss?: ReturnType<typeof XCSSProp<…>> }) => +export const Component = ({ xcss }: { xcss?: StrictXCSSProp<…> }) => <div className={xcss} /> ``` Particularly when contrasted against the non-createStrictAPI `XCSSProp` type, which is different. * Change `XCSSAllProperties` (which we document for usage) to be our `StrictCSSProperties` as it removes some edge-cases.
- Loading branch information