Skip to content

Commit

Permalink
Refactore empty object type
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandrsKondratjevs committed Sep 30, 2022
1 parent 867035f commit 29ced01
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface MyAccountInformationContainerFunctions {

export type MyAccountInformationContainerProps = MyAccountInformationContainerMapStateProps
& MyAccountInformationContainerMapDispatchProps
& RouteComponentProps<Record<string, never>, Record<string, never>, { editPassword?: boolean }>;
& RouteComponentProps<EmptyObject, EmptyObject, { editPassword?: boolean }>;

export interface MyAccountInformationContainerState {
showEmailChangeField: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export interface MyAccountOrderContainerState {
}

export interface MyAccountOrderComponentProps {
order: OrderItem | Record<string, never>;
order: OrderItem | EmptyObject;
isLoading: boolean;
handleReorder: () => void;
is_allowed_reorder: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
import { OrderItem } from 'Query/Order.type';

export interface MyAccountOrderInformationComponentProps {
order: OrderItem | Record<string, never>;
order: OrderItem | EmptyObject;
}
2 changes: 1 addition & 1 deletion packages/scandipwa/src/component/Router/Router.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export interface RouterComponentState {
errorDetails: {
err: Error;
info: ErrorInfo;
} | Record<string, never>;
} | EmptyObject;
hasError: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface LoginAccountContainerMapDispatchProps extends MyAccountOverlayC

export type LoginAccountContainerProps = LoginAccountContainerMapDispatchProps
& MyAccountOverlayContainerProps
& RouteComponentProps<Record<string, never>, Record<string, never>, HistoryState>;
& RouteComponentProps<EmptyObject, EmptyObject, HistoryState>;

export interface LoginAccountContainerFunctions extends MyAccountOverlayContainerFunctions {
onCreateAccountClick: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface SomethingWentWrongContainerBaseProps {
errorDetails: {
err: Error;
info: ErrorInfo;
} | Record<string, never>;
} | EmptyObject;

}

Expand All @@ -37,7 +37,7 @@ export interface SomethingWentWrongComponentProps {
errorDetails: {
err: Error;
info: ErrorInfo;
} | Record<string, never>;
} | EmptyObject;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type UrlRewritesContainerProps = UrlRewritesContainerMapStateProps

export interface UrlRewritesComponentProps {
type: string;
props: UrlRewriteProps | Record<string, never>;
props: UrlRewriteProps | EmptyObject;
}

export type UrlRewritesContainerPropsKeys = 'type'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ WishlistSharedPageContainerMapDispatchProps

export interface WishlistSharedPageContainerState extends MyAccountMyWishlistContainerState {
creatorsName: string;
wishlistItems: Record<string, never>;
wishlistItems: EmptyObject;
isWishlistLoading: boolean;
}

Expand Down
6 changes: 1 addition & 5 deletions packages/scandipwa/src/type/Global.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -125,7 +123,5 @@ declare global {
};
}

// interface HTMLElementEventMap {
// validate: ValidationData
// }
type EmptyObject = Record<string, never>;
}

0 comments on commit 29ced01

Please sign in to comment.