From 54bbfdba60dae678ba8245428475c0a2507ed44b Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Wed, 8 Jan 2020 02:34:26 +0200 Subject: [PATCH] dom-matches: add types/tests (#41399) --- types/dom-matches/dom-matches-tests.ts | 4 ++++ types/dom-matches/index.d.ts | 7 +++++++ types/dom-matches/tsconfig.json | 24 ++++++++++++++++++++++++ types/dom-matches/tslint.json | 1 + 4 files changed, 36 insertions(+) create mode 100644 types/dom-matches/dom-matches-tests.ts create mode 100644 types/dom-matches/index.d.ts create mode 100644 types/dom-matches/tsconfig.json create mode 100644 types/dom-matches/tslint.json diff --git a/types/dom-matches/dom-matches-tests.ts b/types/dom-matches/dom-matches-tests.ts new file mode 100644 index 0000000000..82983a3287 --- /dev/null +++ b/types/dom-matches/dom-matches-tests.ts @@ -0,0 +1,4 @@ +import matches = require('dom-matches'); + +const elem = document.querySelector('.foo'); +matches(elem, '.foo'); // $ExpectType boolean diff --git a/types/dom-matches/index.d.ts b/types/dom-matches/index.d.ts new file mode 100644 index 0000000000..392c3065c1 --- /dev/null +++ b/types/dom-matches/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for dom-matches 2.0 +// Project: https://github.com/necolas/dom-matches +// Definitions by: Avi Vahl +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function matches(element: Element | null | undefined, selector: string): boolean; +export = matches; diff --git a/types/dom-matches/tsconfig.json b/types/dom-matches/tsconfig.json new file mode 100644 index 0000000000..6dba4b6e70 --- /dev/null +++ b/types/dom-matches/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dom-matches-tests.ts" + ] +} diff --git a/types/dom-matches/tslint.json b/types/dom-matches/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dom-matches/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }