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

Improve return type of stripUnit #451

Closed
jasnross opened this issue Jul 10, 2019 · 2 comments
Closed

Improve return type of stripUnit #451

jasnross opened this issue Jul 10, 2019 · 2 comments

Comments

@jasnross
Copy link

jasnross commented Jul 10, 2019

With the deprecation of getValueAndUnit I was looking at replacing it with stripUnit, however the return type of stripUnit is not as helpful as getValueAndUnit, as stripUnit always returns any.

stripUnit(value: (string | number), unitReturn: boolean): any
getValueAndUnit(value: string): [(number | string), (string | void)]
  • polished version: 3.4.1
  • JSS-in_CSS library and version: N/A
  • Any relevant JS library and version: N/A

Mixin/Helper/Shorthand you were using and how you were using it:

const [value, unit] = stripUnit("100px", true);

What you are seeing:

image

image

What you expected to see:

More well-defined return types, such as those previously returned by getValueAndUnit.

Reproduction:

https://codesandbox.io/s/pensive-thunder-z5ijj

@bhough
Copy link
Contributor

bhough commented Sep 6, 2019

This will be addressed in v4.

@bhough
Copy link
Contributor

bhough commented Sep 20, 2020

This has been addressed in v4 which is now in beta and will be released in the coming weeks:

npm install polished@next
yarn add polished@next

@bhough bhough closed this as completed Oct 4, 2020
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