Skip to content

Commit

Permalink
refactor: simplify template literals in types definition (#437)
Browse files Browse the repository at this point in the history
Co-authored-by: Andriy Kuts <[email protected]>
  • Loading branch information
ukrainer and Andriy Kuts authored May 29, 2024
1 parent 066a63e commit 672a48d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/components/PayPalScriptProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { loadScript, PayPalScriptOptions } from "@paypal/paypal-js";
import { PayPalScriptProvider } from "./PayPalScriptProvider";
import { usePayPalScriptReducer } from "../hooks/scriptProviderHooks";
import { SCRIPT_ID, SDK_SETTINGS } from "../constants";
import { DISPATCH_ACTION } from "../types/enums";

jest.mock("@paypal/paypal-js", () => ({
loadScript: jest.fn(),
Expand Down Expand Up @@ -290,7 +291,7 @@ function ResetParamsOnClick({

function onClick() {
dispatch({
type: "resetOptions",
type: DISPATCH_ACTION.RESET_OPTIONS,
value: options as PayPalScriptOptions,
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/types/scriptProviderTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ export interface ReactPayPalScriptOptions extends PayPalScriptOptions {

export type ScriptReducerAction =
| {
type: `${DISPATCH_ACTION.LOADING_STATUS}`;
type: DISPATCH_ACTION.LOADING_STATUS;
value: SCRIPT_LOADING_STATE;
}
| {
type: `${DISPATCH_ACTION.LOADING_STATUS}`;
type: DISPATCH_ACTION.LOADING_STATUS;
value: { state: SCRIPT_LOADING_STATE; message: string };
}
| {
type: `${DISPATCH_ACTION.RESET_OPTIONS}`;
type: DISPATCH_ACTION.RESET_OPTIONS;
value: ReactPayPalScriptOptions;
}
| {
type: `${DISPATCH_ACTION.SET_BRAINTREE_INSTANCE}`;
type: DISPATCH_ACTION.SET_BRAINTREE_INSTANCE;
value: BraintreePayPalCheckout;
};

Expand Down

0 comments on commit 672a48d

Please sign in to comment.