Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript] Fix sx types and missing style prop from layout components #191

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/pigment-css-react/src/Box.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type PolymorphicComponentProps<
AsTarget extends React.ElementType | undefined,
AsTargetProps extends object = AsTarget extends React.ElementType
? React.ComponentPropsWithRef<AsTarget>
: BaseDefaultProps,
: React.HTMLAttributes<HTMLElement>,
> = NoInfer<Omit<Substitute<BaseProps, AsTargetProps>, 'as' | 'component'>> & {
/**
* The component used for the root node.
Expand Down Expand Up @@ -37,6 +37,6 @@ export interface PolymorphicComponent<BaseProps extends BaseDefaultProps>
): React.JSX.Element;
}

declare const Box: PolymorphicComponent<{}>;
declare const Box: PolymorphicComponent<React.DetailsHTMLAttributes<HTMLDivElement>>;

export default Box;
4 changes: 3 additions & 1 deletion packages/pigment-css-react/src/Container.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type ContainerBaseProps = {
maxWidth?: Breakpoint | false;
};

declare const Container: PolymorphicComponent<ContainerBaseProps>;
declare const Container: PolymorphicComponent<
ContainerBaseProps & React.DetailsHTMLAttributes<HTMLDivElement>
>;

export default Container;
4 changes: 3 additions & 1 deletion packages/pigment-css-react/src/Grid.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type GridBaseProps = {
wrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
};

declare const Grid: PolymorphicComponent<GridBaseProps>;
declare const Grid: PolymorphicComponent<
GridBaseProps & React.DetailsHTMLAttributes<HTMLDivElement>
>;

export default Grid;
4 changes: 3 additions & 1 deletion packages/pigment-css-react/src/Hidden.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ interface HiddenBaseProps extends HiddenUp, HiddenDown {
only?: Breakpoint | Breakpoint[];
}

declare const Hidden: PolymorphicComponent<HiddenBaseProps>;
declare const Hidden: PolymorphicComponent<
HiddenBaseProps & React.DetailsHTMLAttributes<HTMLDivElement>
>;

export default Hidden;
4 changes: 3 additions & 1 deletion packages/pigment-css-react/src/Stack.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ type StackBaseProps = {
className?: string;
};

declare const Stack: PolymorphicComponent<StackBaseProps>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a typecheck test for the change if possible ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

declare const Stack: PolymorphicComponent<
StackBaseProps & React.DetailsHTMLAttributes<HTMLDivElement>
>;

export default Stack;
Loading