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<ShippingMethod>'.`

## How

* Change the `selector` type to `Selector<ShippingOption>`
This commit is contained in:
patpich
2023-05-07 06:52:45 -04:00
committed by GitHub
parent cff54d7325
commit 3d6bcaaf65
2 changed files with 6 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
fix(medusa): ShippingOptionService.list method param type

View File

@@ -143,7 +143,7 @@ class ShippingOptionService extends TransactionBaseService {
* @return {Promise} the result of the find operation
*/
async list(
selector: Selector<ShippingMethod>,
selector: Selector<ShippingOption>,
config: FindConfig<ShippingOption> = { skip: 0, take: 50 }
): Promise<ShippingOption[]> {
const optRepo = this.activeManager_.withRepository(this.optionRepository_)