jonobr1 / two.js

A renderer agnostic two-dimensional drawing api for the web.
https://two.js.org
MIT License
8.31k stars 455 forks source link

[Bug] Typo in index.d.ts: class name Rectangl instead of Rectangle #555

Closed herrla closed 2 years ago

herrla commented 3 years ago

Describe the bug It's not possible to create a Rectangle instance with new Two.Rectangle(...); due to a typo in the index.d.ts file. The class name stated there in line 461 is Rectangl, it should be Rectangle.

To Reproduce Steps to reproduce the behavior:

  1. Create ts file containing let rect = new Two.Rectangle(0,0,1,1);
  2. Run TS Compiler it will fail due to the unknown class Two.Rectangle

otherwise if you use Two.Rectangl the JS runtime in the browser will throw an exception as it does not know the Two.Rectangl class.

Expected behavior Two.Rectangle should be a known class to the TS compiler.

Environment: Packaged software: yarn encore

Desktop: Browser Chrome v93

jonobr1 commented 3 years ago

Thanks for posting this. If you use the latest npm version there should be an amended shim of Two.js's types so that you're free to use it all in Typescript without any documentation.

Overall the Typescript types are broken in many ways and I'm in the process of updating this to be based on the actual code and not on the jsdocs (this will make it more accurate).

jonobr1 commented 2 years ago

Keeping track of this issue over here: https://github.com/jonobr1/two.js/issues/531