-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Labels
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
2.1.2
Web browser and version
No response
Operating system
No response
Steps to reproduce this
Element.size() return value is incorrect
The generated types from the element size method look like this:
size(): Element;
size(w?: number | typeof p5.AUTO, h?: number | typeof p5.AUTO): Element;but really they should be
size(): { width: number; height: number }; // (or `Object`)
size(w?: number | typeof p5.AUTO, h?: number | typeof p5.AUTO): Element;@chainable code
I haven't narrowed down the exact problem, but when @return {Element} is used directly instead of @chainable the type compilation is more correct.
The problem source is likely this line, wherechainable is applied per-method instead of per-overload.
Proposed solutions
Quick fix: Use @return {Element} instead of @chainable when there's an override
Right fix: Figure out how to get @chainable working per-overload instead of per-method