⚙️ Add utility types for component props handling

This commit is contained in:
pheralb
2025-08-21 11:57:00 +01:00
parent 1eff7b8788
commit 5d2ec852cf
+11
View File
@@ -0,0 +1,11 @@
export type WithoutChild<T> = T extends { child?: unknown }
? Omit<T, "child">
: T;
export type WithoutChildren<T> = T extends { children?: unknown }
? Omit<T, "children">
: T;
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & {
ref?: U | null;
};