Skip to content

Commit 9dc7137

Browse files
committed
Add typings for Typescript compilation
Add typings to the package, so Typescript programs can directly import this library as a module and use it with: import {code as dragAndDrop} from 'html-dnd'; driver.executeScript(dragAndDrop, draggable, droppable); Also update docs accordingly.
1 parent c082532 commit 9dc7137

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ client
7979
```
8080

8181

82+
### With Typescript
83+
84+
```typescript
85+
import {code as dragAndDrop} from 'html-dnd';
86+
87+
driver.executeScript(dragAndDrop, draggable, droppable);
88+
```
89+
90+
8291
See also
8392
--------
8493

html-dnd.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Type definitions for html-dnd
2+
// Project: https://github.com/Kuniwak/html-dnd
3+
// Definitions by: Adrien Vergé <https://github.com/adrienverge>
4+
5+
declare module 'html-dnd' {
6+
var htmlDnd: {
7+
code: string,
8+
codeForSelectors: string,
9+
};
10+
export = htmlDnd;
11+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,6 @@
6363
"bugs": {
6464
"url": "https://github.com/Kuniwak/html-dnd/issues"
6565
},
66+
"typings": "html-dnd.d.ts",
6667
"homepage": "https://github.com/Kuniwak/html-dnd#readme"
6768
}

0 commit comments

Comments
 (0)