[element-closest] add types (#43264)

This commit is contained in:
Hikiko
2020-03-22 13:53:02 -07:00
committed by GitHub
parent 26e018e9e2
commit fc61649f49
4 changed files with 60 additions and 0 deletions
@@ -0,0 +1,25 @@
import elementClosest from 'element-closest';
// $ExpectError
elementClosest(null);
// $ExpectError
elementClosest(undefined);
// $ExpectError
elementClosest(100);
// $ExpectError
elementClosest('test');
// $ExpectError
elementClosest(false);
// $ExpectError
elementClosest(true);
// $ExpectError
elementClosest({});
// $ExpectType void
elementClosest(window);
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for element-closest 3.0
// Project: https://github.com/jonathantneal/closest#readme
// Definitions by: hikiko4ern <https://github.com/hikiko4ern>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
declare function polyfill(window: Window): void;
export = polyfill;
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"element-closest-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }