SAP Knowledge Base Article - Preview

3581931 - 2211.36 Composable Storefront Upgrade - Cannot access ambient const enums when isolatedModules is enabled

Symptom

As part of the 2211.36 upgrade,  In the "compilerOptions" section of tsconfig.json,  a new option "isolatedModules": true is added.

If your application references the CheckoutStepType enum from @spartacus/checkout/base/components,

When running yarn run start (effectively ng serve --ssl), the terminal console shows the following error:

[ERROR] TS2748: Cannot access ambient const enums when 'isolatedModules' is enabled. [plugin angular-compiler]
src/app/spartacus/spartacus-configuration.module.ts:335:19:
335 │ type: [CheckoutStepType.DELIVERY_ADDRESS, CheckoutSte...
╵ ~~~~~~~~~~~~~~~~
The error occurs in the spartacus-configuration.module.ts file, specifically in the checkout configuration lines:

import { CheckoutStepType, DeliveryModePreferences } from '@spartacus/checkout/base/root';

checkout: {
  express: true,
  guest: true,
  defaultDeliveryMode: [DeliveryModePreferences.FREE],
  steps: [
    {
      id: 'shippingAddress',
      name: 'checkoutProgress.shippingAddress',
      routeName: 'multiStepCheckoutSummaryPage',
      type: [CheckoutStepType.DELIVERY_ADDRESS, CheckoutStepType.DELIVERY_MODE],
    },

This is just one usage example; 


Read more...

Environment

SAP Commerce Cloud

Composable Storefront 2211.36

Product

SAP Commerce Cloud, composable storefront all versions

Keywords

Composable Storefront, isolatedModules, enums , KBA , CEC-SPA , SAP Commerce Cloud Spartacus , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.