Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
more typedef fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nerrad committed Mar 5, 2020
1 parent 0c229db commit 5df7852
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion assets/js/settings/shared/settings-init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
* @type {import("@woocommerce/type-defs/settings").WooCommerceSharedSettings}
*/
const defaults = {
adminUrl: '',
countries: [],
countries: {},
currency: {
code: 'USD',
precision: 2,
Expand All @@ -21,19 +24,29 @@ const defaults = {
wcAssetUrl: '',
};

// @ts-ignore wcSettings is window global
const globalSharedSettings = typeof wcSettings === 'object' ? wcSettings : {};

// Use defaults or global settings, depending on what is set.
/**
* @type {import("@woocommerce/type-defs/settings").WooCommerceSharedSettings}
*/
const allSettings = {
...defaults,
...globalSharedSettings,
};

/**
* @type {import("@woocommerce/type-defs/settings").WooCommerceSiteCurrency}
*/
allSettings.currency = {
...defaults.currency,
...allSettings.currency,
};

/**
* @type {import("@woocommerce/type-defs/settings").WooCommerceSiteLocale}
*/
allSettings.locale = {
...defaults.locale,
...allSettings.locale,
Expand Down

0 comments on commit 5df7852

Please sign in to comment.