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

[types] Fix signature of steps and mix functions #323

Merged
merged 2 commits into from Aug 21, 2023

Conversation

MysteryBlokHed
Copy link
Member

@MysteryBlokHed MysteryBlokHed commented Aug 8, 2023

Fixes #322

This PR fixes the definitions of steps and mix on the Color class, which previously didn't have the correct return type.

@lloydk
Copy link
Collaborator

lloydk commented Aug 11, 2023

I don't think this change is correct. The steps function really does return PlainColorObject[] and the steps method on the Color class converts the PlainColorObject[] to Color[]

The Color class defines the steps methods here: https://github.com/LeaVerou/color.js/blob/2bd19b0a913da3f3310b9d8c1daa859ceb123c37/types/src/index.d.ts#L72
Those methods have the wrong return type (PlainColorObject[] instead of Color[]).

Not sure what the correct fix should be, maybe inline the method definitions instead of using ToColorPrototype so the return type can be changed to Color[]?

@lloydk
Copy link
Collaborator

lloydk commented Aug 11, 2023

The mix methods on the Color class have the same issue. They have a return type of PlainColorObject but the return type should be Color.

@MysteryBlokHed MysteryBlokHed changed the title [types] Fix signature of steps function [types] Fix signature of steps and mix functions Aug 14, 2023
@jgerigmeyer jgerigmeyer merged commit b2896f4 into color-js:main Aug 21, 2023
6 checks passed
@MysteryBlokHed MysteryBlokHed deleted the types/fix-steps branch August 21, 2023 20:07
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.

TypeScript error for steps and PlainColorObject
3 participants