From 5df78523f254867a942b2254788cd5746b0e8446 Mon Sep 17 00:00:00 2001 From: Darren Ethier Date: Thu, 5 Mar 2020 11:56:57 -0500 Subject: [PATCH] more typedef fixes --- assets/js/settings/shared/settings-init.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/assets/js/settings/shared/settings-init.js b/assets/js/settings/shared/settings-init.js index 82a3f26ae4e..08a6b3edd09 100644 --- a/assets/js/settings/shared/settings-init.js +++ b/assets/js/settings/shared/settings-init.js @@ -1,6 +1,9 @@ +/** + * @type {import("@woocommerce/type-defs/settings").WooCommerceSharedSettings} + */ const defaults = { adminUrl: '', - countries: [], + countries: {}, currency: { code: 'USD', precision: 2, @@ -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,