Skip to content

Commit

Permalink
[element-closest] add types (DefinitelyTyped#43264)
Browse files Browse the repository at this point in the history
  • Loading branch information
hikiko4ern committed Mar 22, 2020
1 parent 26e018e commit fc61649
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
25 changes: 25 additions & 0 deletions types/element-closest/element-closest-tests.ts
@@ -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 changes: 9 additions & 0 deletions types/element-closest/index.d.ts
@@ -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 changes: 25 additions & 0 deletions types/element-closest/tsconfig.json
@@ -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 change: 1 addition & 0 deletions types/element-closest/tslint.json
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

0 comments on commit fc61649

Please sign in to comment.