TypeScript Migration for SuiteCommerce Advanced Customization

TypeScript migration enhances SuiteCommerce Advanced for better development efficiency and scalability. It introduces key changes for custom functionality.

·2 min read·View Oracle Docs

Starting with SuiteCommerce Advanced (SCA), source code is being migrated to TypeScript incrementally. TypeScript is an open-source superset of JavaScript that aims to improve development efficiency. Here’s what you need to know about this transition and its significance.

What is TypeScript?

TypeScript builds on JavaScript by adding static types, which helps catch errors early and enhances code quality. The migration to TypeScript is essential for modernizing SCA applications and ensuring better maintainability.

Key Migration Changes

The ongoing migration includes several significant changes:

  • File Extensions: The filename extension is changed from .js to .ts, indicating that the file is a TypeScript file.
  • Module System: The migration involves transforming from Asynchronous Module Definition (AMD) to a TypeScript-compatible module system, commonly used in modern JavaScript development.
  • Base Classes: New base classes are being implemented for Models and Collections, which will provide foundational structures for building SCA applications.
  • Utility Functions: The Utils.ts file is migrated to adopt TypeScript syntax and type safety.
  • Specific Models and Collections: Certain models, such as Case.Model and Case.Collection, have been specifically migrated to TypeScript for improved functionality and performance.

Development Tools

To facilitate this migration, SCA includes developer tools that automatically compile TypeScript files back into standard JavaScript. The commands gulp local and gulp deploy are particularly useful for developers, as they simplify the build process by handling the conversion to JavaScript in the background.

Best Practices for Customization

It's crucial to note that users should not edit SCA source code directly. Instead, they should leverage SCA developer tools to extend or override existing functionalities. For more effective customization, refer to best practices outlined in the SCA documentation.

Who Should Care?

The transition to TypeScript impacts:

  • Developers: Who require modern coding practices to create reliable and scalable applications.
  • Administrators: Who oversee the deployment and maintenance of SuiteCommerce Advanced solutions.
  • Custom Developers: Those interested in building new features or enhancements using the SCA framework.

Key Takeaways

  • TypeScript migration is a phased process aimed at improving SCA's scalability and maintainability.
  • Developers should utilize SCA tools for customization instead of directly modifying source files.
  • Ongoing changes involve vital structural updates for a more efficient codebase.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

Does the migration to TypeScript affect existing customizations in SuiteCommerce Advanced?
Yes, the migration to TypeScript can affect existing customizations. Developers are encouraged to use SCA developer tools to extend or override functionalities rather than directly editing source code, following best practices outlined in the SCA documentation.
What module system changes should developers be aware of during this transition?
The migration involves transforming the module system from Asynchronous Module Definition (AMD) to a TypeScript-compatible module system, which is more aligned with modern JavaScript development practices.
Are there specific files or models in SuiteCommerce Advanced that have already been migrated to TypeScript?
Yes, specific models such as `Case.Model` and `Case.Collection` have been migrated to TypeScript to enhance functionality and performance. Additionally, the `Utils.ts` file now adopts TypeScript syntax and type safety.
What tools are recommended for compiling TypeScript files in SuiteCommerce Advanced?
SCA includes developer tools that automatically compile TypeScript files back into standard JavaScript. Commands like `gulp local` and `gulp deploy` are useful as they handle the conversion process, simplifying the build process for developers.
Source: TypeScript Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Commerce

View all Commerce articles →