map.apps Bundle APIs 4.20.0
    Preparing search index...

    Function declare

    • Helper to declare Mutable classes from a specification. This is also the default export.

      NOTE: This overload constructs mutables that use "$inherit".

      Type Parameters

      • Def extends MutableDefinition<any>

      Parameters

      • definition: Def & { $inherit: any } & ThisType<
            Mutable<BuildMutableMembers<Def> & Record<string | symbol, unknown>>,
        >

        an object with a class specification.

      Returns MutableConstructor<BuildMutableMembers<Def> & Record<string | symbol, unknown>>

      const Clazz = declare({
      firstName: "",
      lastName: "",
      fullName: {
      depends: ["firstName", "lastName"],
      get(): string {
      return `${this.firstName} ${this.lastName}`;
      }
      }
      });
      const x = new Clazz();
    • Helper to declare Mutable classes from a specification. This is also the default export.

      Type Parameters

      • Def extends MutableDefinition<any>

      Parameters

      • definition: Def & ThisType<Mutable<BuildMutableMembers<Def>>>

        an object with a class specification.

      Returns MutableConstructor<BuildMutableMembers<Def>>

      const Clazz = declare({
      firstName: "",
      lastName: "",
      fullName: {
      depends: ["firstName", "lastName"],
      get(): string {
      return `${this.firstName} ${this.lastName}`;
      }
      }
      });
      const x = new Clazz();