Add typings for focus-within (#24935)

* add typings for focus-within

* fix test filenames

* fix typings and tests according to review comments
This commit is contained in:
Damien Erambert
2018-04-12 10:03:10 -07:00
committed by Mohamed Hegazy
parent 8cf4294b84
commit 81cb59546f
5 changed files with 65 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for focus-within 1.0
// Project: https://github.com/jonathantneal/focus-within#readme
// Definitions by: Damien Erambert <https://github.com/eramdam>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace focusWithin {
interface FocusWithinOpts {
attr?: boolean;
className?: string;
}
}
declare function focusWithin(document: HTMLDocument, opts?: focusWithin.FocusWithinOpts): void;
export as namespace focusWithin;
export = focusWithin;
@@ -0,0 +1,10 @@
/*
* This file tests the typings of the global export of `focus-within`
*/
focusWithin(document);
focusWithin(document, {
attr: false,
className: 'foo'
});
@@ -0,0 +1,11 @@
/*
* This file tests the typings of the default export of `focus-within`
*/
import focusWithin = require("focus-within");
focusWithin(document);
focusWithin(document, {
attr: false,
className: 'foo'
});
+25
View File
@@ -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
},
"files": [
"index.d.ts",
"test/focus-within-global-tests.ts",
"test/focus-within-import-default-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}