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

[Enhancement] Add return type for vector functions #542

Closed
supjs opened this issue Jun 16, 2021 · 2 comments
Closed

[Enhancement] Add return type for vector functions #542

supjs opened this issue Jun 16, 2021 · 2 comments

Comments

@supjs
Copy link

supjs commented Jun 16, 2021

Is your feature request related to a problem? Please describe.
I am using PhpStorm and the automatically generated typings for the vector all use return type void.

Examples:

clone(): void;
add(v: Two.Vector): void;
sub(v: Two.Vector): void;

Describe the solution you'd like
Add a return type to the documentation so that it returns Two.Vector instead.

See functions like makeRectangle:

/**
 * @name Two#makeRectangle
 * @function
 * @param {Number} x
 * @param {Number} y
 * @param {Number} width
 * @param {Number} height
 * @returns {Two.Rectangle}
 * @description Creates a Two.js rectangle and adds it to the scene.
 */
@jonobr1
Copy link
Owner

jonobr1 commented Jun 20, 2021

Thanks for posting this and sorry for the delayed response. I'll track this on the es6 features branch here: https://github.com/jonobr1/two.js/tree/es6

@jonobr1
Copy link
Owner

jonobr1 commented Jan 10, 2022

I haven't tested this, but it looks like phpStorm can infer types from imported packages. Two.js's latest version has these included.

@jonobr1 jonobr1 closed this as completed Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants