RSX Code Reference
    Preparing search index...
    • rsx
    • Reflection

    Class Reflection

    The Reflection class provides reflection utilities for TypeScript types.

    Index
    • get allTypes(): Type[]

      Returns all types defined in all assemblies in current domain.

      Returns Type[]

    • Checks if conversion between two types can be performed by Reflection.ConvertType.

      Parameters

      • sourceType: Type

        Source type that will be converted.

      • targetType: Type

        Type to convert the object into.

      Returns boolean

      Whether the conversion can be performed.

    • Tries to convert an object to given target type.

      Parameters

      • source: any

        Source object that will be converted.

      • targetType: Type

        Type to convert the object into.

      Returns any

      Resulting converted object.

    • Construct a new instance of type by calling it at new type(...parameters).

      Type Parameters

      • T

      Parameters

      • type: ClassOf<T>

        The type of object to be constructed.

      • ...parameters: any[]

        The constructor parameters.

      Returns any

      The newly created instance of type.

    • Gets the value from a property or field.

      Parameters

      • instance: any

        The instance to access the property or field from.

      • propertyName: string

        The name of the property to be retrieved.

      Returns any

      The value of the property.

    • Gets a generation that iterates over all classes of the specified module.

      Parameters

      • module: object

      Returns Generator<ReflectionType<any>>

    • Returns array with types that are represented by input ReflectionType array for use in interop.

      Parameters

      • reflectionTypes: Type[]

      Returns Type[]

      Array of System.Type with types represented in input array.

    • Gets an array of all properties, fields and method of the object.

      Parameters

      • instance: any

        The instance to fetch property names from.

      • includeFunctions: boolean

      Returns string[]

      An array of all instance property names.

    • Returns type of given instance.

      Parameters

      • instance: any

        The instance to inspect.

      Returns ReflectionType<any>

      ReflectionType representing type of given object.

    • Returns an array of all classes that implement the specified base type.

      Parameters

      • type: Type

        The base type.

      Returns ReflectionType<any>[]

    • Returns type of given instance.

      Type Parameters

      • T

      Parameters

      • instance: T

        The instance to inspect.

      Returns SubclassOf<T>

      The type of the given instance.

      if instance is null

    • Returns type that has given name.

      Parameters

      • name: string

        Name of type to search for.

      Returns Type

      ReflectionType representing type with given name.

    • Invokes a method on instance.

      Parameters

      • instance: any

        The instance to invoke the method on.

      • methodName: string

        The name of the method to be invoked.

      • ...parameters: any[]

        An array of parameters to be passed to the method invocation.

      Returns any

      The return value of the method call.

    • Returns an array of all classes that implement the specified base type.

      Parameters

      • type: Type

        The base type.

      Returns Generator<ReflectionType<any>>

    • Sets the value of a property or field.

      Parameters

      • instance: any

        The instance to access the property or field from.

      • propertyName: string

        The name of the property to be set.

      • propertyValue: any

        The value of the property.

      Returns void