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

Fix @theme-ui/color types #42425

Closed

Conversation

allanpope
Copy link
Contributor

@allanpope allanpope commented Feb 17, 2020

@hasparus Thanks for picking up that the parameter order was wrong, totally missed that 🤦‍♂.
Have fixed up the parameter order, added more tests and marked number in the mix function as optional, as the source has a default param.

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If changing an existing definition:

@typescript-bot typescript-bot added the Unowned This PR touches a package that doesn't have any listed owners. label Feb 17, 2020
@typescript-bot
Copy link
Contributor

typescript-bot commented Feb 17, 2020

@allanpope Thank you for submitting this PR!

Because this PR doesn't have any code reviewers, a DefinitelyTyped maintainer will be reviewing it in the next few days once the Travis CI build passes.

In the meantime, if the build fails or a merge conflict occurs, I'll let you know. Have a nice day!

@allanpope allanpope closed this Feb 17, 2020
@allanpope allanpope reopened this Feb 17, 2020
@hasparus
Copy link
Contributor

hasparus commented Feb 17, 2020

TBH, all of these functions are 2nd order and take theme parameter at the second invocation. I'm also not sure if the tests are right https://theme-ui.com/packages/color/. Instead of #ff0 we receive primary, a key of theme.colors.

Take a look at .d.ts emitted in system-ui/theme-ui#672.

@allanpope
Copy link
Contributor Author

@hasparus Yeah, so it takes a theme color eg: 'primary' as the first parameter. Within the function it does a get to pull the value out of the theme object.

Are you suggesting that I pull out the theme color names from the theme object and then use them? eg:

// Ideally grab these from theme object
const themeColors = 'primary' | 'secondary' etc..

export function darken(color: themeColors, number: number | string): string;

I didn't know that you had opened a PR on theme-ui for this. Since theme-ui will have built in types, I may as well close this PR, use yours once it's merged in and remove this package from DT.

@typescript-bot
Copy link
Contributor

typescript-bot commented Feb 17, 2020

@allanpope The Travis CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@PranavSenthilnathan
Copy link
Contributor

I'll close this for now as mentioned in the comments. If you wanted to have this merged, feel free to reopen or send another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unowned This PR touches a package that doesn't have any listed owners.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants