RUM JavaScript API - 1.333.0
    Preparing search index...

    Dynatrace Api Types

    This package contains the Typescript type information for the dynatrace API of the RUM JavaScript.

    Keep in mind that when the RUM JavaScript is updated, this type package also has to be updated to provide accurate types.

    npm install --save-dev @dynatrace/rum-javascript-sdk
    

    Make sure to add these paths to "typeRoots" in tsconfig.json under "compilerOptions"

    "typeRoots": ["./node_modules/@types", "./node_modules/@dynatrace/"],
    

    Type inference works out of the box for dynatrace calls.

    if (window.dynatrace) {
    window.dynatrace.sendEvent({
    "event_properties.prop": "value"
    });
    } else {
    // handle missing dynatrace api
    }

    In case some specific types or enums are needed, you can import them from dynatrace types library.

    import { JSONObject } from '@dynatrace/rum-javascript-sdk/types';

    function createJSONObject(): JSONObject {
    return {
    "event_properties.someProp": "someValue"
    };
    }

    if (window.dynatrace) {
    window.dynatrace.sendEvent(createJSONObject());
    } else {
    // handle missing dynatrace api
    }

    Refer to the User Actions API for details about dynatrace.userActions.