From 01a1a5649b5a8abff2dbf680c951a357da61bd0f Mon Sep 17 00:00:00 2001 From: Peter Safranek Date: Fri, 27 Apr 2018 23:41:32 -0700 Subject: [PATCH] Add typings for chromedriver. (#25380) --- types/chromedriver/chromedriver-tests.ts | 11 +++++++++++ types/chromedriver/index.d.ts | 14 ++++++++++++++ types/chromedriver/tsconfig.json | 23 +++++++++++++++++++++++ types/chromedriver/tslint.json | 1 + 4 files changed, 49 insertions(+) create mode 100644 types/chromedriver/chromedriver-tests.ts create mode 100644 types/chromedriver/index.d.ts create mode 100644 types/chromedriver/tsconfig.json create mode 100644 types/chromedriver/tslint.json diff --git a/types/chromedriver/chromedriver-tests.ts b/types/chromedriver/chromedriver-tests.ts new file mode 100644 index 0000000000..abafb29676 --- /dev/null +++ b/types/chromedriver/chromedriver-tests.ts @@ -0,0 +1,11 @@ +import * as chromeDriver from 'chromedriver'; +import { ChildProcess } from 'child_process'; + +const chromeDriverPath: string = chromeDriver.path; +const chromeDriverVersion: string = chromeDriver.version; + +chromeDriver.start(); +chromeDriver.stop(); + +const driverProcess: ChildProcess = chromeDriver.start(['a', 'b', 'c']); +const chromeDriverDefaultInstance: ChildProcess | undefined = chromeDriver.defaultInstance; diff --git a/types/chromedriver/index.d.ts b/types/chromedriver/index.d.ts new file mode 100644 index 0000000000..af48749615 --- /dev/null +++ b/types/chromedriver/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for chromedriver 2.38 +// Project: https://github.com/giggio/node-chromedriver +// Definitions by: Peter Safranek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { ChildProcess } from 'child_process'; + +export const path: string; +export const version: string; +export function start(args?: ReadonlyArray): ChildProcess; +export function stop(): void; +export let defaultInstance: ChildProcess | undefined; diff --git a/types/chromedriver/tsconfig.json b/types/chromedriver/tsconfig.json new file mode 100644 index 0000000000..3727446dd9 --- /dev/null +++ b/types/chromedriver/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chromedriver-tests.ts" + ] +} diff --git a/types/chromedriver/tslint.json b/types/chromedriver/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chromedriver/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }