Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript complains when trying to use operators such as += on Vector2 #96

Open
ceuk opened this issue Mar 24, 2021 · 3 comments
Open
Labels
documentation Request/proposal related to documenation investigation Needs some investigation

Comments

@ceuk
Copy link

ceuk commented Mar 24, 2021

e.g. Something like this:

 this.position += new godot.Vector2(this.velocity * delta)

Will generate the following error in typescript:

Operator '+=' cannot be applied to types 'godot.Vector2' and this.position + 'godot. 
—————————————————
The left-hand side of an arithmetic operation must be of type godot.register_property 'any', 'number', 'bigint' or an enum type. 

Is this an error on my part of a problem wit the type declaration?

@ceuk
Copy link
Author

ceuk commented Mar 24, 2021

specifying any types for the Vector2 properties in question gets rid of the error, but kind of defeats the purpose of using typescript to begin with

@CreatCodeBuild
Copy link

This needs to modify how tsc's type checker is implemented, which is out of scope for this project, likely. Project like Deno suffer similar problems as well because Deno uses TS slightly differently from NodeJS.

If this project doesn't fork tsc, an acceptable workround for me is to omit this kind of errors in the Godot VS code plugin. (override TS language server's diagnostic output)

@scgm0
Copy link

scgm0 commented Mar 7, 2022

#33

@nmerget nmerget added the documentation Request/proposal related to documenation label Sep 16, 2024
@nmerget nmerget added the investigation Needs some investigation label Sep 27, 2024
@nmerget nmerget added this to Kanban Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Request/proposal related to documenation investigation Needs some investigation
Projects
Status: No status
Development

No branches or pull requests

4 participants