Fix
Some checks failed
Lint / lint (push) Failing after 9s

This commit is contained in:
Julien Valverdé
2025-12-29 23:52:39 +01:00
parent bd31fd5ea4
commit 5dd051ce71
5 changed files with 39 additions and 26 deletions

View File

@@ -0,0 +1,15 @@
import type * as Godot from "godot"
import * as React from "react"
import type * as JSX from "./JSX.js"
export type Props<T extends Godot.Node> = JSX.PropsFromInstance<T>
export type Component<T extends Godot.Node> = React.FunctionComponent<Props<T>>
export const make = <T extends Godot.Node>(
class_: new (...args: any[]) => T
): Component<T> => {
const f = (props: Props<T>) => React.createElement("element", { ...props, class: class_ })
f.displayName = class_.name
return f
}

View File

@@ -17,7 +17,7 @@ export type GodotIntrinsicElements = {
}
export type PropsFromInstance<T> = {
// biome-ignore lint/complexity/noBannedTypes: it's completely fine
// biome-ignore lint/complexity/noBannedTypes: using Function here is completely fine
[K in keyof T as T[K] extends Function ? never : K]?: T[K]
}
@@ -25,6 +25,10 @@ declare global {
namespace React {
namespace JSX {
interface IntrinsicElements extends GodotIntrinsicElements {}
interface IntrinsicAttributes {
children?: React.ReactNode
name?: string
}
}
}
}

View File

@@ -1,14 +0,0 @@
import type * as Godot from "godot"
import * as React from "react"
import type * as JSX from "./JSX.js"
export type NodeProps<T extends Godot.Node> = {
readonly class: new (...args: any[]) => T
} & JSX.PropsFromInstance<NoInfer<T>>
export function Node<T extends Godot.Node>(
props: NodeProps<T>
): React.JSX.Element {
return React.createElement("element", props)
}

View File

@@ -1,4 +1,4 @@
export * as Component from "./Component.js"
export * as JSX from "./JSX.js"
export * from "./Node.js"
export * as Reconciler from "./Reconciler.js"
export * as Renderer from "./Renderer.js"