-
Notifications
You must be signed in to change notification settings - Fork 115
refactor: use null instead of {} #1068
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
Conversation
660eac9 to
1811c57
Compare
| @@ -0,0 +1,55 @@ | |||
| import type { CustomerAddress, CartAddressInterface } from '~/modules/GraphQL/types'; | |||
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.
(file was moved from address.js)
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.
Maybe the file should be located in modules/checkout/helpers?
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.
I'm just changing the extension :P
| telephone: string; | ||
| } | ||
|
|
||
| export const getInitialCheckoutAddressForm = () : CheckoutAddressForm => ({ |
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.
Thanks to this, the {} can be avoided
1811c57 to
7b5929e
Compare
| export const getConfiguredVariant = (product: ConfigurableCartItem): ProductInterface | null => product?.configured_variant || null; | ||
|
|
||
| // eslint-disable-next-line import/no-named-as-default-member | ||
| export const getFormattedPrice = (price: number) => getFormattedPrice(price); |
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.
removed weird self-referencing getter. it's not used anywhere
| @@ -0,0 +1,55 @@ | |||
| import type { CustomerAddress, CartAddressInterface } from '~/modules/GraphQL/types'; | |||
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.
Maybe the file should be located in modules/checkout/helpers?
7b5929e to
415ab27
Compare
In Checkout.vue and Billing.vue there was a case where
getSomeData() || {}was used. This was probably done to avoid worrying if something is null or not and avoiding the "x is null, trying to access property abc" error.The problem with that is that it also causes problems with typing, as you'd get errors like "X is not assignable to {}"