Skip to content

Commit

Permalink
refactor(props): prefer interfaces over types
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Jul 9, 2024
1 parent 0aa188f commit 1640cfd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
12 changes: 4 additions & 8 deletions src/components/ButtonSecondary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ import { clsx } from "clsx/lite";
import { getResetClassName } from "css-homogenizer/reset-scoped";
import { forwardRef } from "react";

import type { Merge } from "../utils/types";

export type ButtonSecondaryProps = Merge<
React.ComponentPropsWithRef<"button">,
{
size?: "md";
}
>;
export interface ButtonSecondaryProps
extends React.ComponentPropsWithRef<"button"> {
size?: "md";
}

export const ButtonSecondary = forwardRef(function ButtonSecondary(
{ size = "md", className, ...props }: ButtonSecondaryProps,
Expand Down
12 changes: 4 additions & 8 deletions src/components/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ import { clsx } from "clsx/lite";
import { getResetClassName } from "css-homogenizer/reset-scoped";
import { forwardRef } from "react";

import type { Merge } from "../utils/types";

export type InputProps = Merge<
React.ComponentPropsWithRef<"input">,
{
size?: "sm";
}
>;
export interface InputProps
extends Omit<React.ComponentPropsWithRef<"input">, "size"> {
size?: "sm";
}

export const Input = forwardRef(function Input(
{ size = "sm", className, ...props }: InputProps,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Popover.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { clsx } from "clsx/lite";
import { forwardRef } from "react";

export type PopoverProps = React.ComponentPropsWithRef<"div">;
export interface PopoverProps extends React.ComponentPropsWithRef<"div"> {}

export const Popover = forwardRef(function Popover(
{ className, ...props }: PopoverProps,
Expand Down
5 changes: 0 additions & 5 deletions src/utils/types.ts

This file was deleted.

0 comments on commit 1640cfd

Please sign in to comment.