godotjs / godotjs/javascript

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

Open
#96 3 comments 0 reactions 0 assignees View on GitHub
documentation investigation
Dominant language
C++
Stars
1.1k
Forks
80
PR merge metrics
No merged PRs in 30d

Description

e.g. Something like this:

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

Will generate the following error in typescript:

```error
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?

Contributor guide

Open the contributing guide

Research direction

Reproduce the TypeScript example with godot.Vector2 and inspect the Vector2 type declaration used by the binding. Compare the reported operator errors with TypeScript's operator rules; done means determining whether the declaration is incorrect or whether the operation is unsupported, with the expected usage documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.