Geequlim / ECMAScript

Javascript binding for godotengine
MIT License
959 stars 84 forks source link

.d.ts file has errors #181

Open TheColorRed opened 9 months ago

TheColorRed commented 9 months ago

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

fukaraadam commented 9 months ago

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

KashubaK commented 7 months ago

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.

nmerget commented 7 months ago

@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.

grndctrl commented 7 months ago

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(...)?
pkra8 commented 5 months ago

@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

SebastianAtWork commented 4 months ago

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?