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

Add: support for arguments reading pattern in typescript definition. #1865

Conversation

sasensi
Copy link
Contributor

@sasensi sasensi commented Nov 3, 2020

Description

Introduces hardcoded generic types in the typescript definition template that
are used to support arguments reading pattern (that allows a method to accept
either a Point instance or an array of number or an object...).

Maybe this can find a place in JSDoc at some point but I think that this does the job for now.

Related issues

Checklist

  • New tests added or existing tests modified to cover all changes
  • Code conforms with the JSHint rules (npm run jshint passes)

Introduces hardcoded generic types in the typescript definition template that
are used to support arguments reading pattern (that allows a method to accept
either a Point instance or an array of number or an object...).
@HriBB
Copy link
Contributor

HriBB commented Sep 22, 2022

@sasensi what is the status on this PR? I really need this ;) Typescript types are basically useless if you use string colors or array points.

@lehni can we merge this?

@lehni
Copy link
Member

lehni commented Oct 21, 2022

I'm so sorry for never looking into this. The code looks good! It only adds the versions that read from objects, while in JS you can also do <METHOD_NAME>(x, y) instead of <METHOD_NAME>({ x, y }) where pointLike values are read. With this change, only <METHOD_NAME>([x, y]) will be supported.

@lehni lehni merged commit 6a7a458 into paperjs:develop Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants