Skip to content

Commit f721636

Browse files
committed
fix: type inference for the module build
1 parent 633b422 commit f721636

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

packages/sdk/src/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,26 @@ import type { Module } from '@vue-storefront/sdk';
22
import { connector } from './connector';
33
import { ModuleOptions } from './types';
44

5+
/**
6+
* @deprecated This type is deprecated and will be removed in the next major version.
7+
* It is no longer necessary to use this type. Please, check documentation of `magentoModule`.
8+
*/
59
export interface MagentoModuleType extends Module {
610
connector: ReturnType<typeof connector>;
711
}
812

913
/**
1014
* Magento module.
1115
*
12-
* @example
13-
*
14-
* Initialization of the Magento module.
16+
* @example Initialization of the Magento module.
1517
*
1618
* ```js
1719
* import { initSDK, buildModule } from '@vue-storefront/sdk';
1820
* import { magentoModule, MagentoModuleType } from '@vue-storefront/magento2-sdk'
1921
*
2022
* const sdkConfig = {
2123
* magento:
22-
* buildModule<MagentoModuleType>(
24+
* buildModule(
2325
* magentoModule,
2426
* {
2527
* apiUrl: 'http://localhost:8181/magento',
@@ -30,7 +32,7 @@ export interface MagentoModuleType extends Module {
3032
* export const sdk = initSDK<typeof sdkConfig>(sdkConfig);
3133
* ```
3234
*/
33-
export const magentoModule = (options: ModuleOptions): MagentoModuleType => {
35+
export const magentoModule = (options: ModuleOptions) => {
3436
return {
3537
connector: connector(options),
3638
};

packages/sdk/src/types/ModuleOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ export interface ModuleOptions {
1010
/**
1111
* The SSR API URL of the Magento instance
1212
*/
13-
ssrApiUrl: string;
13+
ssrApiUrl?: string;
1414
}

0 commit comments

Comments
 (0)