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

This commit is contained in:
Julien Valverdé
2025-12-28 23:53:22 +01:00
parent 0c642b655e
commit 945ef34829

View File

@@ -1,4 +1,5 @@
import type * as Godot from "godot"
import type { CamelCase } from "type-fest"
type NodeClass = {
@@ -7,25 +8,23 @@ type NodeClass = {
: never
}[keyof typeof Godot]
type DecapitalizeString<S extends string> = S extends `${infer F}${infer R}` ? `${Lowercase<F>}${R}` : S
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 DecapitalizeString<K>]: PropsFromInstance<InstanceType<(typeof Godot)[K]>>
[K in NodeClass as CamelCase<K>]: PropsFromInstance<InstanceType<(typeof Godot)[K]>>
} & {
custom: {
class: new (...args: any[]) => Godot.Node
}
}
// declare global {
declare namespace React {
declare global {
namespace React {
namespace JSX {
interface IntrinsicElements extends GodotIntrinsicElements {}
}
}
// }
}