Table of Contents

What is TypeScript and why is it used in Oqtane Themes?

TypeScript is a strongly typed superset of JavaScript that adds static types, interfaces, and modern language features to standard JavaScript. This helps developers write cleaner, more reliable, and maintainable code by catching errors early during development instead of at runtime.

Why use TypeScript instead of plain JavaScript?

  • Static typing: TypeScript’s type system helps prevent common bugs by checking types at compile time.
  • Modern language features: TypeScript supports upcoming ECMAScript features and compiles them down to browser-compatible JavaScript.
  • Improved code readability: Clear type annotations make it easier to understand complex code and APIs.

How is TypeScript used in Oqtane Themes?

In Oqtane themes, TypeScript is mainly used to write client-side logic such as event handling, animations, or interaction with DOM elements. This allows themes to be more dynamic and interactive.

How does TypeScript fit into the build process?

TypeScript files (.ts) are compiled to plain JavaScript by Vite during the build process. Vite handles bundling, optimizing, and hot-reloading of your TypeScript and SCSS files to ensure fast and efficient development.

You can find more information on how Vite compiles TypeScript and SCSS in the Vite documentation.

📘 How to Install Vite