SalesforceCommerceCloud / commerce-sdk-isomorphic

Browser & Node.js JavaScript client for B2C Commerce API
https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/
BSD 3-Clause "New" or "Revised" License
42 stars 20 forks source link

Add prettify helper to make types more readable. #113

Closed wjhsf closed 1 year ago

wjhsf commented 1 year ago

For ShopperBaskets<{shortCode: string; organizationId: string}>['getBasket'], the type is displayed as:

(method) ShopperBaskets<{ shortCode: string; organizationId: string; }>.getBasket(options?: ({
    parameters?: (Omit<{
        organizationId: string;
        basketId: string;
        siteId: string;
        locale?: string | undefined;
    }, "organizationId" | "shortCode"> & Partial<{
        organizationId: string;
        basketId: string;
        siteId: string;
        locale?: string | undefined;
    }>) | undefined;
    headers?: {
        ...;
    } | undefined;
} & Required<...>) | undefined): Promise<...> (+1 overload)

With this change, it's significantly easier to read:

(method) ShopperBaskets<{ shortCode: string; organizationId: string; }>.getBasket(options?: {
    parameters: {
        siteId: string;
        locale?: string | undefined;
        basketId: string;
        organizationId?: string | undefined;
    };
    headers?: {
        [key: string]: string;
    } | undefined;
} | undefined): Promise<...> (+1 overload)