Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

@polymorphic-factory/[email protected]

Compare
Choose a tag to compare
@github-actions github-actions released this 28 Jan 14:12
· 430 commits to main since this release
0a493a1

Minor Changes

  • #192 bc0f72a Thanks @TimKolberger! - Fixed an issue where the factory options type polymorphicFactory<P, Options>() did not propagate
    to the factory function poly("div", options). This is possibly a breaking change for TypeScript
    users.

    type AdditionalProps = Record<never, never>
    type Options = { 'data-custom-option': string }
    
    const poly = polymorphicFactory<AdditionalProps, Options>({
      styled: (component, options) => (props) => {
        const Component = props.as || component
        return <Component data-custom-styled data-options={JSON.stringify(options)} {...props} />
      },
    })
    const CustomDiv = poly('div', { 'data-custom-option': 'hello' })