This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 144
Update @woo…/currency
code docs, define & export type declarations.
#7848
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tomalec
commented
Oct 26, 2021
* @typedef {import('@woocommerce/number').NumberConfig} NumberConfig | ||
*/ | ||
/** | ||
* @typedef {Object} CurrencyProps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make it
Suggested change
* @typedef {Object} CurrencyProps | |
* @typedef {NumberConfig} CurrencyConfig |
It's valid JSDoc, but TypeScirpt is not able to parse it microsoft/TypeScript#20077
Or we can make it
* @typedef {NumberConfig & { code: string, … } } CurrencyProps
But then we lose definitions of the extra props.
This PR has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This PR was automatically closed due to being stale. |
I'm not sure if we can make it before the merge, but if #7840 lands it would be nice to have this as well. |
to match latest linting rules.
5 tasks
Closing in favor of woocommerce/woocommerce#32337 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
And served the same purpose:
CurrencyConfig
type, exports declarations (afa01e3)So they could be referenced in the other packages.
Accessibility
n/a - its only code documentation change
Screenshots
Detailed test instructions:
npm install @woocommerce/currency
{import('@woocommerce/currency').CurrencyConfig}
Additional notes:
This data type could be used further in
@woocommerce/wc-admin-settings
to make the code docs shorter.Preferable I'd not define
CurrencyProps
type, just door at least
But unfortunately, it's not supported by TypeScript yet Support typedef inheritance with JSDoc microsoft/TypeScript#20077
The type of the object returned by
CurrencyFactory
is still not defined, and the individual methods of that object are lost as well. I'd solve that in a separate PR, as I believe we could do a small refactoring by the way. The current code base makes it hard to document and test it. At least that makes this PR shorter and less controversial.No changelog necessary - added entry in package's one.