> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript Multiplication

The `*` (asterisk) token in TypeScript serves four distinct syntactic and operational roles depending on its lexical context: a binary arithmetic operator, a generator function declarator, an iterable delegation operator, and a module namespace wildcard.

## 1. Arithmetic Multiplication Operator

As a binary operator, `*` performs mathematical multiplication. TypeScript's static type system strictly enforces that both operands must be of type `number`, `bigint`, a numeric `enum`, or `any`. Mixing `number` and `bigint` operands without explicit casting results in a compile-time diagnostic error (specifically `TS2365: Operator '*' cannot be applied to types 'number' and 'bigint'`).

```typescript theme={"dark"}
enum Multiplier { Base = 10 }

const leftOperand: number = 5;
const rightOperand: number = Multiplier.Base;

// Syntax visualization
const product: number = leftOperand * rightOperand;
const bigIntProduct: bigint = 5n * 10n;
```

## 2. Generator Function Declarator (`function*`)

When appended to the `function` keyword, `*` acts as a declarator that defines a generator function. This alters the function's evaluation model, causing it to return a `Generator` object rather than executing immediately. In TypeScript, the resulting object is strictly typed using the built-in `Generator<T, TReturn, TNext>` or `IterableIterator<T>` interfaces.

```typescript theme={"dark"}
function* generateSequence(): Generator<number, void, unknown> {
  yield 1;
}

// Syntax visualization
function* identifier() { /* function body */ }
const anonymousGenerator = function* () { /* function body */ };
```

## 3. Iterable Delegation Operator (`yield*`)

Used exclusively within the body of a generator function, the `yield*` expression delegates iteration control to another iterable object. TypeScript's compiler verifies that the expression following `yield*` implements the `Iterable<T>` interface in standard generators. In asynchronous generators (`async function*`), the compiler also accepts and verifies against the `AsyncIterable<T>` interface. TypeScript automatically infers the yielded types from the delegated iterable.

```typescript theme={"dark"}
function* parentGenerator(): Generator<number> {
  // Syntax visualization
  const iterableExpression = [1, 2, 3];
  yield* iterableExpression;
}

async function* asyncParentGenerator(): AsyncGenerator<number> {
  yield* parentGenerator();
}
```

## 4. Module Namespace Wildcard

In ES Module syntax, `*` functions as a wildcard identifier for namespace imports and exports. Its behavior regarding default exports depends strictly on the declaration syntax:

* **Namespace Imports (`import * as Alias`) and Namespace Re-exports (`export * as Alias`):** The `*` token aggregates all exported members from the target module into a single namespace object. This *includes* the default export, which is bound to and accessible via the `.default` property on the alias.
* **Blanket Re-exports (`export * from "module"`):** The `*` token re-exports all named exports from the target module but strictly *excludes* the default export.

TypeScript preserves the strict type definitions of all aggregated members. Furthermore, TypeScript supports a type-only namespace import syntax (`import type * as Alias`), which aggregates exported types while guaranteeing the import is elided from the emitted JavaScript runtime code.

```typescript theme={"dark"}
// Ambient module declarations for valid compilation
declare module "math-utils" {
  export const pi: number;
  export default function add(a: number, b: number): number;
}

declare module "math-types" {
  export type Point = { x: number; y: number };
}

// Namespace Import (Includes default export as MathUtils.default)
import * as MathUtils from "math-utils";

// Type-only Namespace Import
import type * as MathTypes from "math-types";

// Blanket Re-export (Excludes default export)
export * from "math-utils";

// Namespace Re-export (Includes default export as MathUtilsReExport.default)
export * as MathUtilsReExport from "math-utils";
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor TypeScript Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
