Add iopipe-js type declarations

This commit is contained in:
Javon Harper
2019-01-08 12:54:39 -05:00
parent 6769b3d406
commit a1653d1bea
4 changed files with 62 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for iopipe
// Project: https://github.com/iopipe/iopipe-js
interface IOPipeConfig {
debug?: boolean;
token?: string;
networkTimeout?: number;
timeoutWindow?: number;
}
interface Mark {
start(label: string): void;
end(label: string): void;
}
declare module "@iopipe/iopipe" {
export function label(label: string): void;
export function metric(label: string, number: number): void;
export let mark: Mark
export default function iopipe(config?: IOPipeConfig): Function;
}
+17
View File
@@ -0,0 +1,17 @@
import iopipe, { label, mark, metric } from '@iopipe/iopipe'
const configuredLib = iopipe({
token: 'ABCDEFG'
});
const run = () => {}
configuredLib(run)
label('a label');
mark.start('trace');
mark.end('trace');
metric('metric-label', 42);
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"iopipe-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }