Rebass: TypeScript Support rebass v4?

Created on 8 Aug 2019  路  8Comments  路  Source: rebassjs/rebass

@types/rebass is supported rebass v3.
Are there any plans to update the type definition to support v4?

Most helpful comment

It's merged! 馃嵕

All 8 comments

In the meantime, you can use this workaround
create rebass.d.ts with this content:

declare module 'rebass/styled-components' {
    import * as r from 'rebass';
    import { CSSObject } from 'styled-components';
    export interface BaseProps {
        sx?: CSSObject;
    }
    export = r;
}

@martasko it does not work with new props like maxWidth, overflow and others.
Need typings!

I've created a PR a few seconds ago in DefinitelyTyped, please take a look and see if I missed anything 馃檹
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/37709

I've created a PR a few seconds ago in DefinitelyTyped, please take a look and see if I missed anything 馃檹
DefinitelyTyped/DefinitelyTyped#37709

Is there support for theme config variables checking? I don't see it...
For example:

export const Header = ({ transparent }: { transparent?: boolean }) => (
  <Box bg={['secondary', 'secondary', transparent ? 'transparent' : 'primary']} />
)

No validation of enum secondary and primary of theme.colors

We need to to pass ThemedStyledInterface<Theme> of styled-components to rebass and configure relations by the props table.

Maybe it will be easier if we could use functions in props with passing theme.

No, I've only adapted the existing typings to work with v4, didn't add any features.

I understand, but it's not usable in production because there are no checking of theme.

It's merged! 馃嵕

Closing this since it sounds like the type definitions have been updated

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gi-alec picture gi-alec  路  6Comments

jxnblk picture jxnblk  路  5Comments

contra picture contra  路  5Comments

coreybruyere picture coreybruyere  路  5Comments

chiragjani picture chiragjani  路  6Comments