ReviseAlgo Logo

Classes in TypeScript

Static Members

Define class-level properties and static block initializers.

Last Updated: July 29, 2026 10 min read

Static members belong to the class constructor itself rather than instances of the class.

1. Introduction & Architecture

2. Deep Dive & Core Concepts

ES2022 static initialization blocks (static { ... }) allow complex static field setup.

3. Basic Code Example

4. Advanced Production Patterns

5. Interactive Code Playground

class MathUtils { static square(n: number) { return n * n; } }
console.log(MathUtils.square(4));

6. Common Pitfalls & Edge Cases

Note: Static members cannot be accessed via instance reference this inside regular instance methods. Use ClassName.member instead.

7. Interview Q&A & Quizzes

Q: What is the scope of a static class property?

A: Static properties are attached to the constructor function itself and shared across all instances.

8. Summary Comparison Table

Member TypeAccess PatternScope
Instance Memberthis.propUnique per object instance
| Static Member | ClassName.prop | Shared globally on class constructor |