From 9301aed3e37d86e7d2119255c3e8a7ea2dde747a Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Wed, 8 Apr 2026 14:44:27 -0700 Subject: [PATCH] Add ForgeComponent type and define overloads --- src/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index 02639c6..0e8a12e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,5 +1,9 @@ import { type TagDef, type HTMLTag, UnitlessProps, NonStyleKeys } from './types' +type ForgeComponent = + ((props: Record) => any) & + { [K in keyof Parts]: (props: Record) => any } + export const styles: Record> = {} const themes: Record> = {} @@ -288,6 +292,8 @@ export function createScope(scope: string) { } // the main event +export function define(name: string, def: T): ForgeComponent +export function define(def: T): ForgeComponent export function define(nameOrDef: string | TagDef, defIfNamed?: TagDef) { const def = defIfNamed ?? nameOrDef as TagDef const name = defIfNamed ? (nameOrDef as string) : anonName(def)