@@ -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 {}
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user