From 3d6bcaaf65b3a43dfb251460d73e448870b5105f Mon Sep 17 00:00:00 2001 From: patpich <825601+patpich@users.noreply.github.com> Date: Sun, 7 May 2023 06:52:45 -0400 Subject: [PATCH] fix(medusa): ShippingOptionService.list method param type (#4018) ## What Fix typing on ShippingOptionService.list selector parameter ## Why A backend server interfacing with the `ShippingOptionService.list()` method will throw TS error when attempting to pass selector values that should be valid. ## Steps to reproduce * In a IDE that can display TS errors * Create an instance of the ShippingOptionService * Call the `list()` method on the instance with the following selector parameter: `{ region_id: "foobar" }` * Expect: No TS error * Actual: `TS2345: Argument of type '{ region_id: string; }' is not assignable to parameter of type 'Selector'.` ## How * Change the `selector` type to `Selector` --- .changeset/good-beans-know.md | 5 +++++ packages/medusa/src/services/shipping-option.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/good-beans-know.md diff --git a/.changeset/good-beans-know.md b/.changeset/good-beans-know.md new file mode 100644 index 0000000000..7035cf93b8 --- /dev/null +++ b/.changeset/good-beans-know.md @@ -0,0 +1,5 @@ +--- +"@medusajs/medusa": patch +--- + +fix(medusa): ShippingOptionService.list method param type diff --git a/packages/medusa/src/services/shipping-option.ts b/packages/medusa/src/services/shipping-option.ts index 59c73a6430..31d3850469 100644 --- a/packages/medusa/src/services/shipping-option.ts +++ b/packages/medusa/src/services/shipping-option.ts @@ -143,7 +143,7 @@ class ShippingOptionService extends TransactionBaseService { * @return {Promise} the result of the find operation */ async list( - selector: Selector, + selector: Selector, config: FindConfig = { skip: 0, take: 50 } ): Promise { const optRepo = this.activeManager_.withRepository(this.optionRepository_)