From 29ced01b43390254275dd2fddd52f79c653be06c Mon Sep 17 00:00:00 2001 From: aleksandrskondratjevs Date: Fri, 30 Sep 2022 10:40:55 +0300 Subject: [PATCH] Refactore empty object type --- .../MyAccountInformation/MyAccountInformation.type.ts | 2 +- .../src/component/MyAccountOrder/MyAccountOrder.type.ts | 2 +- .../MyAccountOrderInformation.type.ts | 2 +- packages/scandipwa/src/component/Router/Router.type.ts | 2 +- .../scandipwa/src/route/LoginAccount/LoginAccount.type.ts | 2 +- .../src/route/SomethingWentWrong/SomethingWentWrong.type.ts | 4 ++-- .../scandipwa/src/route/UrlRewrites/UrlRewrites.type.ts | 2 +- .../src/route/WishlistSharedPage/WishlistSharedPage.type.ts | 2 +- packages/scandipwa/src/type/Global.type.ts | 6 +----- 9 files changed, 10 insertions(+), 14 deletions(-) diff --git a/packages/scandipwa/src/component/MyAccountInformation/MyAccountInformation.type.ts b/packages/scandipwa/src/component/MyAccountInformation/MyAccountInformation.type.ts index d8b8fc43f6..1acba349f8 100644 --- a/packages/scandipwa/src/component/MyAccountInformation/MyAccountInformation.type.ts +++ b/packages/scandipwa/src/component/MyAccountInformation/MyAccountInformation.type.ts @@ -46,7 +46,7 @@ export interface MyAccountInformationContainerFunctions { export type MyAccountInformationContainerProps = MyAccountInformationContainerMapStateProps & MyAccountInformationContainerMapDispatchProps -& RouteComponentProps, Record, { editPassword?: boolean }>; +& RouteComponentProps; export interface MyAccountInformationContainerState { showEmailChangeField: boolean; diff --git a/packages/scandipwa/src/component/MyAccountOrder/MyAccountOrder.type.ts b/packages/scandipwa/src/component/MyAccountOrder/MyAccountOrder.type.ts index 229cf24fb8..68be3c153b 100644 --- a/packages/scandipwa/src/component/MyAccountOrder/MyAccountOrder.type.ts +++ b/packages/scandipwa/src/component/MyAccountOrder/MyAccountOrder.type.ts @@ -59,7 +59,7 @@ export interface MyAccountOrderContainerState { } export interface MyAccountOrderComponentProps { - order: OrderItem | Record; + order: OrderItem | EmptyObject; isLoading: boolean; handleReorder: () => void; is_allowed_reorder: boolean; diff --git a/packages/scandipwa/src/component/MyAccountOrderInformation/MyAccountOrderInformation.type.ts b/packages/scandipwa/src/component/MyAccountOrderInformation/MyAccountOrderInformation.type.ts index 3ac5da4ea8..59a6e67e9c 100644 --- a/packages/scandipwa/src/component/MyAccountOrderInformation/MyAccountOrderInformation.type.ts +++ b/packages/scandipwa/src/component/MyAccountOrderInformation/MyAccountOrderInformation.type.ts @@ -12,5 +12,5 @@ import { OrderItem } from 'Query/Order.type'; export interface MyAccountOrderInformationComponentProps { - order: OrderItem | Record; + order: OrderItem | EmptyObject; } diff --git a/packages/scandipwa/src/component/Router/Router.type.ts b/packages/scandipwa/src/component/Router/Router.type.ts index 17908c25a3..4a3db987fb 100644 --- a/packages/scandipwa/src/component/Router/Router.type.ts +++ b/packages/scandipwa/src/component/Router/Router.type.ts @@ -63,7 +63,7 @@ export interface RouterComponentState { errorDetails: { err: Error; info: ErrorInfo; - } | Record; + } | EmptyObject; hasError: boolean; } diff --git a/packages/scandipwa/src/route/LoginAccount/LoginAccount.type.ts b/packages/scandipwa/src/route/LoginAccount/LoginAccount.type.ts index 553f0b6668..1eb8d26513 100644 --- a/packages/scandipwa/src/route/LoginAccount/LoginAccount.type.ts +++ b/packages/scandipwa/src/route/LoginAccount/LoginAccount.type.ts @@ -27,7 +27,7 @@ export interface LoginAccountContainerMapDispatchProps extends MyAccountOverlayC export type LoginAccountContainerProps = LoginAccountContainerMapDispatchProps & MyAccountOverlayContainerProps -& RouteComponentProps, Record, HistoryState>; +& RouteComponentProps; export interface LoginAccountContainerFunctions extends MyAccountOverlayContainerFunctions { onCreateAccountClick: () => void; diff --git a/packages/scandipwa/src/route/SomethingWentWrong/SomethingWentWrong.type.ts b/packages/scandipwa/src/route/SomethingWentWrong/SomethingWentWrong.type.ts index cbde5861a2..e373042bdd 100644 --- a/packages/scandipwa/src/route/SomethingWentWrong/SomethingWentWrong.type.ts +++ b/packages/scandipwa/src/route/SomethingWentWrong/SomethingWentWrong.type.ts @@ -25,7 +25,7 @@ export interface SomethingWentWrongContainerBaseProps { errorDetails: { err: Error; info: ErrorInfo; - } | Record; + } | EmptyObject; } @@ -37,7 +37,7 @@ export interface SomethingWentWrongComponentProps { errorDetails: { err: Error; info: ErrorInfo; - } | Record; + } | EmptyObject; } diff --git a/packages/scandipwa/src/route/UrlRewrites/UrlRewrites.type.ts b/packages/scandipwa/src/route/UrlRewrites/UrlRewrites.type.ts index e19072fa04..36c77814a3 100644 --- a/packages/scandipwa/src/route/UrlRewrites/UrlRewrites.type.ts +++ b/packages/scandipwa/src/route/UrlRewrites/UrlRewrites.type.ts @@ -31,7 +31,7 @@ export type UrlRewritesContainerProps = UrlRewritesContainerMapStateProps export interface UrlRewritesComponentProps { type: string; - props: UrlRewriteProps | Record; + props: UrlRewriteProps | EmptyObject; } export type UrlRewritesContainerPropsKeys = 'type' diff --git a/packages/scandipwa/src/route/WishlistSharedPage/WishlistSharedPage.type.ts b/packages/scandipwa/src/route/WishlistSharedPage/WishlistSharedPage.type.ts index a7ab54ba0a..7cacede69a 100644 --- a/packages/scandipwa/src/route/WishlistSharedPage/WishlistSharedPage.type.ts +++ b/packages/scandipwa/src/route/WishlistSharedPage/WishlistSharedPage.type.ts @@ -40,7 +40,7 @@ WishlistSharedPageContainerMapDispatchProps export interface WishlistSharedPageContainerState extends MyAccountMyWishlistContainerState { creatorsName: string; - wishlistItems: Record; + wishlistItems: EmptyObject; isWishlistLoading: boolean; } diff --git a/packages/scandipwa/src/type/Global.type.ts b/packages/scandipwa/src/type/Global.type.ts index 6f40d4a3de..0ff0303d48 100644 --- a/packages/scandipwa/src/type/Global.type.ts +++ b/packages/scandipwa/src/type/Global.type.ts @@ -13,8 +13,6 @@ import { StoreEnhancer } from 'redux'; import { Mix } from './Common.type'; -// import { ValidationData } from 'Util/Validator'; - declare global { interface Window { // eslint-disable-next-line @typescript-eslint/naming-convention @@ -125,7 +123,5 @@ declare global { }; } - // interface HTMLElementEventMap { - // validate: ValidationData - // } + type EmptyObject = Record; }