@@ -2,8 +2,8 @@ import type * as Godot from "godot"
|
||||
import * as React from "react"
|
||||
|
||||
|
||||
export type Component<T extends Godot.Node> = React.FunctionComponent<Props<T>>
|
||||
export type Props<T extends Godot.Node> = {
|
||||
export type Component<T extends Godot.Node<Godot.NodePathMap>> = React.FunctionComponent<Props<T>>
|
||||
export type Props<T extends Godot.Node<Godot.NodePathMap>> = {
|
||||
// biome-ignore lint/complexity/noBannedTypes: using Function here is completely fine
|
||||
[K in keyof T as T[K] extends Function ? never : K]?: T[K]
|
||||
}
|
||||
@@ -13,7 +13,7 @@ export interface InstrinsicAttributes {
|
||||
readonly name?: string
|
||||
}
|
||||
|
||||
export const make = <T extends Godot.Node>(
|
||||
export const make = <T extends Godot.Node<Godot.NodePathMap>>(
|
||||
class_: new (...args: any[]) => T
|
||||
): Component<T> => {
|
||||
const f = (props: Props<T>) => React.createElement("element", { ...props, class: class_ })
|
||||
|
||||
@@ -19,7 +19,7 @@ export const renderComponent: {
|
||||
} = (
|
||||
container: Node<NodePathMap>,
|
||||
component: React.FC<{}>,
|
||||
props?: Record<string, unknown>,
|
||||
props?: React.Attributes,
|
||||
): void => {
|
||||
const reconciler = Reconciler.make()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user