diff --git a/packages/example/src/TestUi1Component.tsx b/packages/example/src/TestUi1Component.tsx index f02b9ae..2dde9bb 100644 --- a/packages/example/src/TestUi1Component.tsx +++ b/packages/example/src/TestUi1Component.tsx @@ -19,7 +19,7 @@ export function TestUi1Component() { text="This is a label" /> - + ) } diff --git a/packages/react-godot-renderer/src/Component.ts b/packages/react-godot-renderer/src/Component.ts index 5b6927f..c747830 100644 --- a/packages/react-godot-renderer/src/Component.ts +++ b/packages/react-godot-renderer/src/Component.ts @@ -1,10 +1,17 @@ import type * as Godot from "godot" import * as React from "react" -import type * as JSX from "./JSX.js" -export type Props = JSX.PropsFromInstance export type Component = React.FunctionComponent> +export type Props = { + // biome-ignore lint/complexity/noBannedTypes: using Function here is completely fine + [K in keyof T as T[K] extends Function ? never : K]?: T[K] +} + +export interface InstrinsicAttributes { + readonly children?: React.ReactNode + readonly name?: string +} export const make = ( class_: new (...args: any[]) => T diff --git a/packages/react-godot-renderer/src/JSX.ts b/packages/react-godot-renderer/src/JSX.ts index 87d8084..adc7b9c 100644 --- a/packages/react-godot-renderer/src/JSX.ts +++ b/packages/react-godot-renderer/src/JSX.ts @@ -1,34 +1,25 @@ -import type * as Godot from "godot" -import type { PascalToCamel } from "./utils.js" +import type * as Component from "./Component.js" -export type NodeClass = { - [K in keyof typeof Godot]: typeof Godot[K] extends new (...args: any[]) => Godot.Node - ? K - : never -}[keyof typeof Godot] +// export type NodeClass = { +// [K in keyof typeof Godot]: typeof Godot[K] extends new (...args: any[]) => Godot.Node +// ? K +// : never +// }[keyof typeof Godot] -export type GodotIntrinsicElements = { - [K in NodeClass as PascalToCamel]: React.JSX.IntrinsicAttributes & PropsFromInstance> -} & { - element: { - class: new (...args: any[]) => Godot.Node - } -} - -export type PropsFromInstance = { - // biome-ignore lint/complexity/noBannedTypes: using Function here is completely fine - [K in keyof T as T[K] extends Function ? never : K]?: T[K] -} +// export type GodotIntrinsicElements = { +// [K in NodeClass as PascalToCamel]: Component.Props> +// } & { +// element: { +// class: new (...args: any[]) => Godot.Node +// } +// } declare global { namespace React { namespace JSX { - interface IntrinsicElements extends GodotIntrinsicElements {} - interface IntrinsicAttributes { - children?: React.ReactNode - name?: string - } + // interface IntrinsicElements extends GodotIntrinsicElements {} + interface IntrinsicAttributes extends Component.InstrinsicAttributes {} } } }