Suggest an editImprove this articleRefine the answer for “Superset of JavaScript”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**TypeScript** extends the JavaScript language by adding static typing, new syntax (enum, type, interface), and support for future JS features, without changing the meaning or behavior of the JavaScript code itself. **Key point:** any valid JavaScript code is also valid TypeScript code.Shown above the full answer for quick recall.Answer (EN)Image### 1. What "superset" means TypeScript **extends** the JavaScript language: - adds **static typing** (type annotations, interfaces, generics); - introduces **new syntax** (for example, `enum`, `type`, `interface`); - supports **future JS features** that are not yet implemented in every environment. At the same time, TypeScript **does not change the meaning or behavior** of JavaScript code - it only adds a layer of type checking *before the program runs*. --- ### 2. Example: any JS is valid TS ```javascript // Regular JavaScript function sum(a, b) { return a + b; } ``` This code is **perfectly valid** in TypeScript too. But in TS you can add types: ```javascript function sum(a: number, b: number): number { return a + b; } ``` Now the compiler checks that `a` and `b` are numbers, and the return value is `number` as well. --- ### 3. How it works "under the hood" TypeScript files (`.ts`): 1. **Go through type checking** (nothing is executed, only analysis); 2. Are then **transpiled** (translated) into plain JavaScript code; 3. The resulting `.js` can run in a browser or Node.js, without needing TS at runtime. --- ### 4. Why this matters Thanks to this architecture, TypeScript: - is fully **compatible with the existing JavaScript ecosystem** (npm, Node.js, React, etc.); - **does not require changing the runtime**, engine, or browser; - adds a **layer of safety and predictability** while staying "transparent" for execution. --- ### Summary > TypeScript is a **superset** of JavaScript, > because it **includes all of JavaScript + adds typing and new features**, > while remaining **compatible with and compilable** to plain JavaScript.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.