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

Added shorthand units to UnitType #470

Merged
merged 2 commits into from
Feb 2, 2019
Merged

Added shorthand units to UnitType #470

merged 2 commits into from
Feb 2, 2019

Conversation

dotlouis
Copy link
Contributor

Thanks for this useful library!

When using Typescript, shorthand units were throwing errors because not recognized.

On a side note, I wonder if the same type (UnitType) should be used for set() and add()/subtract()methods. Because the former does not take a week as a unit (which would count as valid in TS typings). Just a thought.

@codecov-io
Copy link

codecov-io commented Jan 31, 2019

Codecov Report

Merging #470 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@         Coverage Diff         @@
##            dev   #470   +/-   ##
===================================
  Coverage   100%   100%           
===================================
  Files        53     53           
  Lines       470    470           
  Branches     72     72           
===================================
  Hits        470    470

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c4517a8...2c9256f. Read the comment docs.

@iamkun
Copy link
Owner

iamkun commented Jan 31, 2019

@dotlouis thanks you are right, and advice here? Or just copy to another unitType?

@dotlouis
Copy link
Contributor Author

dotlouis commented Jan 31, 2019

Well you can make union types to avoid copying code. Something in the likes of:

type OpUnitType = 'day' | 'hour' // ... all common unit types
type SetUnitType = OpUnitType | 'week' // all additional types

I can make a PR with the changes if you'd like

@iamkun iamkun merged commit abab171 into iamkun:dev Feb 2, 2019
iamkun pushed a commit that referenced this pull request Feb 2, 2019
@dotlouis dotlouis deleted the fix/dotlouis_shorthand_unit_types branch February 3, 2019 14:25
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