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

This commit is contained in:
Julien Valverdé
2025-12-29 00:42:53 +01:00
parent 19c5b91b6b
commit 2398118105
3 changed files with 8 additions and 14 deletions

View File

@@ -41,8 +41,7 @@
"@types/react-reconciler": "~0.32.0"
},
"dependencies": {
"react-reconciler": "~0.33.0",
"type-fest": "^5.3.1"
"react-reconciler": "~0.33.0"
},
"peerDependencies": {
"@types/react": "^19.2.0",

View File

@@ -1,5 +1,4 @@
import type * as Godot from "godot"
import type { CamelCase } from "type-fest"
type NodeClass = {
@@ -8,19 +7,20 @@ type NodeClass = {
: 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]>>
[K in NodeClass as PascalToCamel<K>]: PropsFromInstance<InstanceType<(typeof Godot)[K]>>
} & {
custom: {
class: new (...args: any[]) => Godot.Node
}
}
type PascalToCamel<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]
}
declare global {
namespace React {
namespace JSX {