From 66d20973f355f9ce9d99b9ee2835451be8538897 Mon Sep 17 00:00:00 2001 From: Akshay Karthik Date: Mon, 25 Mar 2019 12:49:54 -0400 Subject: [PATCH] [react-axe] Initial set of typedefs (#34108) * Add dts for react-axe * Lint fixes * Remove the v from the version header * Set strictFunctionTypes to true per code review --- types/react-axe/index.d.ts | 22 ++++++++++++++++++++++ types/react-axe/package.json | 6 ++++++ types/react-axe/react-axe-tests.tsx | 5 +++++ types/react-axe/tsconfig.json | 25 +++++++++++++++++++++++++ types/react-axe/tslint.json | 1 + 5 files changed, 59 insertions(+) create mode 100644 types/react-axe/index.d.ts create mode 100644 types/react-axe/package.json create mode 100644 types/react-axe/react-axe-tests.tsx create mode 100644 types/react-axe/tsconfig.json create mode 100644 types/react-axe/tslint.json diff --git a/types/react-axe/index.d.ts b/types/react-axe/index.d.ts new file mode 100644 index 0000000000..5671204762 --- /dev/null +++ b/types/react-axe/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for react-axe 3.1 +// Project: https://github.com/dequelabs/react-axe +// Definitions by: Akshay Karthik +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import { Spec } from "axe-core"; + +export = axe; + +declare function axe( + react: typeof React, + reactDOM: typeof ReactDOM, + timeout: number, + config?: axe.ReactAxeConfig +): void; + +declare namespace axe { + type ReactAxeConfig = Spec; +} diff --git a/types/react-axe/package.json b/types/react-axe/package.json new file mode 100644 index 0000000000..9d078dcda4 --- /dev/null +++ b/types/react-axe/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "axe-core": "3.2.2" + } +} diff --git a/types/react-axe/react-axe-tests.tsx b/types/react-axe/react-axe-tests.tsx new file mode 100644 index 0000000000..4b7997293f --- /dev/null +++ b/types/react-axe/react-axe-tests.tsx @@ -0,0 +1,5 @@ +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import * as axe from "react-axe"; + +axe(React, ReactDOM, 1000); diff --git a/types/react-axe/tsconfig.json b/types/react-axe/tsconfig.json new file mode 100644 index 0000000000..8efb1ddb70 --- /dev/null +++ b/types/react-axe/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-axe-tests.tsx" + ] +} diff --git a/types/react-axe/tslint.json b/types/react-axe/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/react-axe/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file