ECMAScript icon indicating copy to clipboard operation
ECMAScript copied to clipboard

.d.ts file has errors

Open TheColorRed opened this issue 1 year ago • 6 comments

I installed typescript from Project -> Tools -> JavaScript -> Generate TypeScript Project menu. When doing a test I get errors in the godot.d.ts file:

image

I then also get errors in my test.mts file:

image

However, everything works when the script is compiled to an .mjs file.

Here is a list of all the errors: errors.json

TheColorRed avatar Nov 20 '23 16:11 TheColorRed

Having same problem. For now, I am using old d.ts file from here https://github.com/citizenll/godot-typescript-starter.

fukaraadam avatar Nov 21 '23 14:11 fukaraadam

Yep, same here. Makes using TS not feasible.

Having same problem. For now, I am using old d.ts file from here https://github.com/citizenll/godot-typescript-starter.

The README in that project states that it uses Godot 3.5, surely those definitions aren't compatible?


Seems the bug is somewhere in https://github.com/Geequlim/ECMAScript/blob/master/editor/editor_tools.cpp Unfortunately I don't know C++ at all, so I have no idea how to even approach this. Emscripten seems to have implemented a way to generate .d.ts for ported classes: https://github.com/emscripten-core/emscripten/issues/7083 though I'm not entirely sure how relevant this is, or if this could be integrated into the tool somehow.

KashubaK avatar Jan 17 '24 00:01 KashubaK

@TheColorRed can you check this branch: https://github.com/Geequlim/ECMAScript/pull/190 I don't get any errors in VSCode, so it might be okay.

nmerget avatar Jan 20 '24 11:01 nmerget

Having same problem. For now, I am using old d.ts file from here https://github.com/citizenll/godot-typescript-starter.

Doesn't appear to have 3D types, for instance godot.Node2D is there, but godot.Node3D gives me an error.

Trying to compile the #190 branch gives me a scons error

scons: Reading SConscript files ...
  File "/Users/markbrand/Personal/Godot/godot-engine/godot/SConstruct", line 61

    print "Detected Platforms: "+str(platform_list)

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

grndctrl avatar Jan 29 '24 09:01 grndctrl

@TheColorRed can you check this branch: #190 I don't get any errors in VSCode, so it might be okay.

I'm completely new user, compiled godot with module fine, I'm not having any errors in .mjs files anymore after using fix branch.

image image

Seems however like Transform3D isn't defined. image

pkra8 avatar Apr 05 '24 07:04 pkra8

I looked into the branch for this issue and documented my findings in the Pr : https://github.com/Geequlim/ECMAScript/pull/190 I´d be happy to help, since i find the premise of this library really cool. In addition, I tried to fix some of the code, and got down to 5 errors and as little any as possible. `class Popup extends Window {

	/**  */
	borderless: boolean;

	/**  */
	popup_window: boolean;

	/**  */
	transient: boolean;

	/**  */
	unresizable: boolean;

	/**  */
	visible: boolean;

	/**  */
	wrap_controls: boolean;

	/** Getter of `borderless` property */
	get_flag() : boolean;

	/** Setter of `borderless` property */
	set_flag(p_value: boolean) : void;

	/** Getter of `popup_window` property */
	get_flag() : boolean;

	/** Setter of `popup_window` property */
	set_flag(p_value: boolean) : void;

	/** Getter of `transient` property */
	is_transient() : boolean;

	/** Setter of `transient` property */
	set_transient(p_value: boolean) : void;

	/** Getter of `unresizable` property */
	get_flag() : boolean;

	/** Setter of `unresizable` property */
	set_flag(p_value: boolean) : void;

	/** Getter of `visible` property */
	is_visible() : boolean;

	/** Setter of `visible` property */
	set_visible(p_value: boolean) : void;

	/** Getter of `wrap_controls` property */
	is_wrapping_controls() : boolean;

	/** Setter of `wrap_controls` property */
	set_wrap_controls(p_value: boolean) : void;
}`

The main problem left seem to be the generated window subclasses. The methods dont have the name of the property, they are setting. Was this always a problem?

SebastianAtWork avatar Apr 21 '24 12:04 SebastianAtWork