refactor: remove explicit any across admin forms and catalog actions
Local Build and Deploy / deploy (push) Canceled after 40s
Local Build and Deploy / deploy (push) Canceled after 40s
- Type resolveAsChild generically over Base UI render-prop type - Type catalog/rooms/catalog-items Prisma updates with Prisma.*UpdateInput - Type EventForm/PollForm with explicit form-value interfaces - Type EventPrizesManager/PollQuestionsManager with validator input types - All typecheck, lint, and 312 tests pass
This commit is contained in:
1 parent
907a4399d0
commit
3eaffe658d
8 files changed
+61
-23
No files matched your search
+7
-5
@@ -1,20 +1,22 @@
|
||||
import { isValidElement, type ReactNode } from "react";
|
||||
import { isValidElement, type ReactElement, type ReactNode } from "react";
|
||||
|
||||
/**
|
||||
* Map Radix-style `asChild` onto Base UI's `render` prop.
|
||||
* Generic over the render-prop type so component-specific Base UI render
|
||||
* signatures (e.g. `UseRenderRenderProp<ButtonState>`) are preserved.
|
||||
*/
|
||||
export function resolveAsChild(
|
||||
export function resolveAsChild<R = ReactElement | undefined>(
|
||||
asChild: boolean | undefined,
|
||||
children: ReactNode,
|
||||
render?: any,
|
||||
render?: R,
|
||||
): {
|
||||
render?: any;
|
||||
render?: R;
|
||||
children: ReactNode;
|
||||
} {
|
||||
if (render != null) return { render, children };
|
||||
if (asChild && isValidElement(children)) {
|
||||
return {
|
||||
render: children,
|
||||
render: children as R,
|
||||
children: (children.props as { children?: ReactNode }).children,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user