Added type definitions for "ineum" (#38275)

* Added type definitions for "ineum"

ineum is the global object used by the Instana Website Monitoring API (https://docs.instana.io/products/website_monitoring/api/) to collect different kinds of information from websites/apps.

* Added tests and fixed header lint issue

* Fixed test file and added minimum TS version

* Merged definitions with same signature, added dummy version number

* Made userName and userEmail optional

* Removed unnecessary type reference
This commit is contained in:
Enzo Volkmann 2019-09-13 17:51:07 +02:00 committed by Mine Starks
parent 9c9f822b82
commit f574f4aa13
4 changed files with 74 additions and 0 deletions

17
types/ineum/index.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
// Type definitions for non-npm package ineum-browser 1.0
// Project: https://docs.instana.io/products/website_monitoring/api/
// Definitions by: Enzo Volkmann <https://github.com/evolkmann>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.2
// Website Monitoring API from Instana (status: 2019-09-10)
declare function ineum(command: 'key' | 'reportingUrl' | 'page' | 'traceId', value: string): void;
declare function ineum(command: 'user', userId: string, userName?: string, userEmail?: string): void;
declare function ineum(command: 'meta', key: string, value: string): void;
declare function ineum(command: 'autoClearResourceTimings' | 'wrapEventHandlers' | 'wrapTimers', enable: boolean): void;
declare function ineum(command: 'getPageLoadId'): string | undefined;
declare function ineum(command: 'reportError', error: string, opts?: {
componentStack: string
}): void;
declare function ineum(command: 'ignoreUrls' | 'ignoreErrorMessages' | 'whitelistedOrigins', values: RegExp[]): void;

View File

@ -0,0 +1,33 @@
// $ExpectType void
ineum("key", "key");
// $ExpectType void
ineum("reportingUrl", "reportingUrl");
// $ExpectType void
ineum("page", "pageName");
// $ExpectType void
ineum("user", "userId", "userName", "userEmail");
// $ExpectType void
ineum("meta", "key", "value");
// $ExpectType void
ineum("traceId", "traceId");
// $ExpectType void
ineum("ignoreUrls", [/regex/]);
// $ExpectType void
ineum("autoClearResourceTimings", true);
// $ExpectType void
ineum("reportError", "error");
// $ExpectType void
ineum("reportError", "error", {
componentStack: "stack"
});
// $ExpectType void
ineum("ignoreErrorMessages", [/regex/]);
// $ExpectType void
ineum("wrapEventHandlers", true);
// $ExpectType void
ineum("wrapTimers", true);
// $ExpectType void
ineum("whitelistedOrigins", [/regex/]);
// $ExpectType string | undefined
ineum("getPageLoadId");

23
types/ineum/tsconfig.json Normal file
View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ineum-tests.ts"
]
}

1
types/ineum/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }