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

path.clone() doesn't have the right return type in TypeScript #1795

Closed
sasensi opened this issue Apr 6, 2020 · 0 comments · Fixed by #1796
Closed

path.clone() doesn't have the right return type in TypeScript #1795

sasensi opened this issue Apr 6, 2020 · 0 comments · Fixed by #1796
Labels
cat: typescript status: PR proposed an active pull request should fix this issue type: bug

Comments

@sasensi
Copy link
Contributor

sasensi commented Apr 6, 2020

Description/Steps to reproduce

import * as paper from 'paper';

let path = new paper.Path();
path = path.clone();

The last assignment produces an error because path.clone() return type is Item and not Path as it should be.

Expected result

This code should not produce any error.

Workaround

import * as paper from 'paper';

let path = new paper.Path();
path = path.clone() as paper.Path;
sasensi added a commit to sasensi/paper.js that referenced this issue Apr 6, 2020
Adds a new custom JSDoc tag allowing typescript definition to use `this` type as
a return type for inherited methods.

Closes paperjs#1795
@sasensi sasensi added the status: PR proposed an active pull request should fix this issue label Apr 6, 2020
lehni pushed a commit that referenced this issue May 25, 2020
* Fix typescript returned instance type

Adds a new custom JSDoc tag allowing typescript definition to use `this` type as
a return type for inherited methods.

Closes #1795

* Fix code style

* Rename `tsReturnThis` custom tag to `chainable`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat: typescript status: PR proposed an active pull request should fix this issue type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant