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

This commit is contained in:
Julien Valverdé
2025-12-30 23:40:19 +01:00
parent a19746d3ab
commit 7eceb4e20e
3 changed files with 25 additions and 27 deletions

View File

@@ -19,7 +19,7 @@ export function TestUi1Component() {
text="This is a label"
/>
<node2D name="Issou" />
<GodotControl name="Issou" />
</GodotControl>
)
}

View File

@@ -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<T extends Godot.Node> = JSX.PropsFromInstance<T>
export type Component<T extends Godot.Node> = React.FunctionComponent<Props<T>>
export type Props<T extends Godot.Node> = {
// 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 = <T extends Godot.Node>(
class_: new (...args: any[]) => T

View File

@@ -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<K>]: React.JSX.IntrinsicAttributes & PropsFromInstance<InstanceType<(typeof Godot)[K]>>
} & {
element: {
class: new (...args: any[]) => Godot.Node
}
}
export type PropsFromInstance<T> = {
// 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<K>]: Component.Props<InstanceType<(typeof Godot)[K]>>
// } & {
// 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 {}
}
}
}