Skip to content

Commit c82dfac

Browse files
fix: Ensure the GAny union type includes null
1 parent 72e0bf6 commit c82dfac

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@godot-js/editor": patch
3+
---
4+
5+
**Types**: Ensure the GAny union type includes null

scripts/jsb.editor/src/jsb.editor.codegen.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,13 +2586,12 @@ export class TSDCodeGen {
25862586
}
25872587

25882588
if (GodotAnyType != "any") {
2589-
let gd_variant_alias = `type ${GodotAnyType} = `;
2589+
let gd_variant_alias = `type ${GodotAnyType} = undefined | null`;
25902590
for (let i = godot.Variant.Type.TYPE_NIL + 1; i < godot.Variant.Type.TYPE_MAX; ++i) {
25912591
const type_name = get_primitive_type_name(i);
25922592
if (type_name == GodotAnyType || type_name == "any") continue;
2593-
gd_variant_alias += type_name + " | ";
2593+
gd_variant_alias += " | " + type_name;
25942594
}
2595-
gd_variant_alias += "undefined";
25962595
cg.line(gd_variant_alias);
25972596
}
25982597

0 commit comments

Comments
 (0)