Variable TypedJSONConst

TypedJSON: {
    ArrayTypeDescriptor: any;
    MapTypeDescriptor: any;
    SetTypeDescriptor: any;
    MapShape: any;
    JsonObjectMetadata: any;
    TypedJSON: any;
    AnyT: ConcreteTypeDescriptor;
    options: {
        mergeOptions: any;
    };
    typeDescriptor: {
        ArrayTypeDescriptor: any;
        MapTypeDescriptor: any;
        SetTypeDescriptor: any;
        ensureTypeDescriptor: any;
    };
    utils: {
        isInstanceOf: any;
        isSubtypeOf: any;
        isValueDefined: any;
        nameof: any;
    };
    ArrayT(elementType): ArrayTypeDescriptor;
    MapT(keyType, valueType, options?): MapTypeDescriptor;
    SetT(elementType): SetTypeDescriptor;
    defaultTypeEmitter(targetObject, sourceObject, expectedSourceType, sourceTypeMetadata?): void;
    defaultTypeResolver(sourceObject, knownTypes): Function | undefined;
    jsonArrayMember(maybeTypeThunk, options?): ((target, propKey) => void);
    jsonMapMember(maybeKeyThunk, maybeValueThunk, options?): ((target, propKey) => void);
    jsonMember<T>(prototype, propertyKey): void;
    jsonMember(options): PropertyDecorator;
    jsonMember(type, options?): PropertyDecorator;
    jsonObject<T>(options?): ((target) => void);
    jsonObject<T>(options?): ((target) => void);
    jsonObject<T>(target): void;
    jsonSetMember(maybeTypeThunk, options?): ((target, propKey) => void);
    toJson<T>(target): void;
    toJson<T>(options): ((target) => void);
} = ...

Type declaration

  • AnyT: ConcreteTypeDescriptor
  • options: {
        mergeOptions: any;
    }
    • mergeOptions: any
  • typeDescriptor: {
        ArrayTypeDescriptor: any;
        MapTypeDescriptor: any;
        SetTypeDescriptor: any;
        ensureTypeDescriptor: any;
    }
    • ArrayTypeDescriptor: any
    • MapTypeDescriptor: any
    • SetTypeDescriptor: any
    • ensureTypeDescriptor: any
  • utils: {
        isInstanceOf: any;
        isSubtypeOf: any;
        isValueDefined: any;
        nameof: any;
    }
    • isInstanceOf: any
    • isSubtypeOf: any
    • isValueDefined: any
    • nameof: any
  • ArrayT:function
  • MapT:function
    • Parameters

      • keyType: Typelike
      • valueType: Typelike
      • Optional options: Partial<MapOptions>

      Returns MapTypeDescriptor

  • SetT:function
  • defaultTypeEmitter:function
    • Parameters

      Returns void

  • defaultTypeResolver:function
    • Parameters

      Returns Function | undefined

  • jsonArrayMember:function
    • Specifies that a property, of type array, is part of an object when serializing.

      Parameters

      • maybeTypeThunk: MaybeTypeThunk

        Constructor of array elements (e.g. 'Number' for 'number[]', or 'Date' for 'Date[]').

      • Optional options: IJsonArrayMemberOptions

        Additional options.

      Returns ((target, propKey) => void)

        • (target, propKey): void
        • Parameters

          • target: Object
          • propKey: string | symbol

          Returns void

  • jsonMapMember:function
    • Specifies that the property is part of the object when serializing. Use this decorator on properties of type Map<K, V>.

      Parameters

      • maybeKeyThunk: MaybeTypeThunk

        Constructor of map keys (e.g. 'Number' for 'Map<number, Date>').

      • maybeValueThunk: MaybeTypeThunk

        Constructor of map values (e.g. 'Date' for 'Map<number, Date>').

      • Optional options: IJsonMapMemberOptions

        Additional options.

      Returns ((target, propKey) => void)

        • (target, propKey): void
        • Parameters

          • target: Object
          • propKey: string | symbol

          Returns void

  • jsonMember:function
    • Specifies that a property is part of the object when serializing. Requires ReflectDecorators.

      Type Parameters

      • T extends Function

      Parameters

      Returns void

    • Specifies that a property is part of the object when serializing, with additional options. Requires ReflectDecorators.

      Parameters

      • options: IJsonMemberOptions

      Returns PropertyDecorator

    • Specifies that a property is part of the object when serializing, with a defined type and extra options.

      Parameters

      • type: MaybeTypeThunk
      • Optional options: IJsonMemberOptions

      Returns PropertyDecorator

  • jsonObject:function
    • Marks that a class with a parameterized constructor is serializable using TypedJSON, with additional settings. The 'initializer' setting must be specified.

      Type Parameters

      • T

      Parameters

      • Optional options: IJsonObjectOptionsWithInitializer<T>

        Configuration settings.

      Returns ((target) => void)

    • Marks that a class is serializable using TypedJSON, with additional settings.

      Type Parameters

      • T

      Parameters

      • Optional options: IJsonObjectOptions<T>

        Configuration settings.

      Returns ((target) => void)

    • Marks that a class with a parameterless constructor is serializable using TypedJSON.

      Type Parameters

      • T

      Parameters

      Returns void

  • jsonSetMember:function
    • Specifies that the property is part of the object when serializing. Use this decorator on properties of type Set.

      Parameters

      • maybeTypeThunk: MaybeTypeThunk

        Constructor of set elements (e.g. 'Number' for Set or 'Date' for Set).

      • Optional options: IJsonSetMemberOptions

        Additional options.

      Returns ((target, propKey) => void)

        • (target, propKey): void
        • Parameters

          • target: Object
          • propKey: string | symbol

          Returns void

  • toJson:function
    • Decorator that will generate toJSON function on the class prototype that allows JSON.stringify to be used instead of TypedJSON.stringify. Under the hood it will simply delegate to TypedJSON. By default it will throw if the prototype already has a toJSON function defined.

      Type Parameters

      • T extends Object

      Parameters

      • target: Function

        the class which prototype should be modified.

      Returns void

    • Decorator factory that accepts the options interface.

      Type Parameters

      • T extends Object

      Parameters

      • options: IToJsonOptions

        for configuring the toJSON creation.

      Returns ((target) => void)

        • (target): void
        • Parameters

          • target: Function

          Returns void