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

build: add explicit return types #682

Conversation

johnhooks
Copy link
Contributor

Add explicit return types to all functions.

fix #681

@vercel
Copy link

vercel bot commented Nov 29, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
dinerojs ❌ Failed (Inspect) Nov 29, 2022 at 7:06PM (UTC)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 29, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 898ef79:

Sandbox Source
@dinero.js/example-cart-react Configuration
@dinero.js/example-cart-vue Configuration
@dinero.js/example-pricing-react Configuration
@dinero.js/example-starter Configuration

@johnhooks
Copy link
Contributor Author

@sarahdayan check these out, it's just a start. But my initial thought is that it's super repetitive. The params have to be explicitly typed in quite a few places. If you are considering simplifying the packages, I think the core/src/api should be moved to dinero.js. The most useful component of @dinero.js/core is to hold all the types and keep from having circular dependancies.

@sarahdayan
Copy link
Collaborator

@johnhooks Yes, that's one of the items in the v2 beta project (somehow I can't link directly to a card, but it's the Reconsider package breakdown one.

I'm not convinced we even need a core package anymore. It was initially done because the plan was to provide Dinero.js with two APIs (chainable and functional) but this was dropped.

Circular dependencies shouldn't be an issue since both the the currencies and calculator are dependency-free.

@johnhooks
Copy link
Contributor Author

@sarahdayan I can't comment in the project section. Though I did leave a comment in the v2 discussion. #618 (comment)

@johnhooks
Copy link
Contributor Author

@sarahdayan I think core is important for types, especially with the TS project references, there can't be circular dependencies. If all the types are in dinero.js and another package needs them, but is then also imported back into dinero.js it will break.

@johnhooks
Copy link
Contributor Author

Though if everything, but the currencies, is moved into the main package then it doesn't matter.

@johnhooks
Copy link
Contributor Author

@sarahdayan

Circular dependencies shouldn't be an issue since both the the currencies and calculator are dependency-free.

The calculators import core for types

@sarahdayan
Copy link
Collaborator

I can't comment in the project section.

I turned the project card into an issue (#683), you can comment on it now.

If all the types are in dinero.js and another package needs them, but is then also imported back into dinero.js it will break.
The calculators import core for types

Yup, but I'm not convinced calculators should be separate. They could be in dinero.js and as far as UMD is concerned, be exposed as a separate UMD endpoint.

We can discuss this all in #683 to avoid scattering thoughts.

@johnhooks
Copy link
Contributor Author

johnhooks commented Dec 1, 2022

@sarahdayan I'm not going to touch this until there is some resolution to issues #685 and
#683.

Do you want help accomplishing this? If not I will close this PR.

I'm definitely willing to help, but understand if you want to tackle this yourself.

@sarahdayan sarahdayan deleted the branch dinerojs:feat/to-units December 4, 2022 11:08
@sarahdayan sarahdayan closed this Dec 4, 2022
@sarahdayan
Copy link
Collaborator

Looks like it got closed because #309 was merged. Normally it should have switched target branch for main.

Feel free to reopen @johnhooks.

@johnhooks
Copy link
Contributor Author

@sarahdayan its not giving me the option to reopen. We can open a new PR once decisions have been made about reorganizing the structure. If core/src/api moves to dinero.js it would simplify a lot of the typing.

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.

2 participants