import type * as Godot from "godot"
import type { CamelCase } from "type-fest"


type NodeClass = {
    [K in keyof typeof Godot]: typeof Godot[K] extends new (...args: any[]) => Godot.Node
        ? K
        : never
}[keyof typeof Godot]

type PropsFromInstance<T> = {
    // biome-ignore lint/complexity/noBannedTypes: it's completely fine
    [K in keyof T as T[K] extends Function ? never : K]?: T[K]
}

type GodotIntrinsicElements = {
    [K in NodeClass as CamelCase<K>]: PropsFromInstance<InstanceType<(typeof Godot)[K]>>
} & {
    custom: {
        class: new (...args: any[]) => Godot.Node
    }
}

declare global {
    namespace React {
        namespace JSX {
            interface IntrinsicElements extends GodotIntrinsicElements {}
        }
    }
}
