Skip to content

Commit

Permalink
chore: correct type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
jer3m01 committed Apr 3, 2024
1 parent 3d3da8e commit 55823fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions packages/core/src/polymorphic/polymorphic.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/* @refresh reload */

import { OverrideProps } from "@kobalte/utils";
import { ComponentProps, JSX, ValidComponent, splitProps } from "solid-js";
import { Dynamic } from "solid-js/web";

/* -------------------------------------------------------------------------------------------------
* Polymorphic
* -----------------------------------------------------------------------------------------------*/

// Combine T and P by overriding T
export type OverrideProps<T, P> = Omit<T, keyof P> & P;

/**
* Polymorphic attribute.
*/
Expand Down
8 changes: 4 additions & 4 deletions packages/utils/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export type OverrideComponentProps<T extends ValidComponent, P> = OverrideProps<
P
>;

export function mergeDefaultProps<T extends Record<string, any>>(
defaultProps: Partial<T>,
export function mergeDefaultProps<T extends {}, D extends Partial<T>>(
defaultProps: D,
props: T,
): T {
return mergeProps(defaultProps, props);
): OverrideProps<T, D> {
return mergeProps(defaultProps, props) as OverrideProps<T, D>;
}

0 comments on commit 55823fe

Please sign in to comment.