Library API
    Preparing search index...

    Function Immutable

    • A class decorator that freezes a class instance to prevent modification. Provides "silent immutability" by silently ignoring modifications in non-strict mode.

      Type Parameters

      Parameters

      • value: T

        The class constructor to freeze

      • context: ClassDecoratorContext<T>

        The decorator context

      Returns void | T

      The immutable class wrapper

      Workaround: To protect against aggressive bundlers (Rollup/Terser) mutating the TS 7.0 ES2022 decorator IIFE structure, users must append return Object.freeze(this) as this; to their constructors to ensure immutability survives production bundling.

      @Immutable
      class Config { ... }