dom-matches: add types/tests (#41399)

This commit is contained in:
Avi Vahl 2020-01-08 02:34:26 +02:00 committed by Armando Aguirre
parent 2d34dc1046
commit 54bbfdba60
4 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,4 @@
import matches = require('dom-matches');
const elem = document.querySelector('.foo');
matches(elem, '.foo'); // $ExpectType boolean

7
types/dom-matches/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
// Type definitions for dom-matches 2.0
// Project: https://github.com/necolas/dom-matches
// Definitions by: Avi Vahl <https://github.com/AviVahl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function matches(element: Element | null | undefined, selector: string): boolean;
export = matches;

View File

@ -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"
]
}

View File

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