Skip to content

Commit

Permalink
fix: export typings from src (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
ph-fritsche authored Mar 19, 2021
1 parent 2180430 commit 16314c6
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 99 deletions.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.0-semantically-released",
"description": "Fire events the same way the user does",
"main": "dist/index.js",
"typings": "typings/index.d.ts",
"keywords": [
"react-testing-library",
"dom-testing-library",
Expand All @@ -25,8 +24,7 @@
},
"homepage": "https://github.com/testing-library/user-event#readme",
"files": [
"dist",
"typings/index.d.ts"
"dist"
],
"scripts": {
"build": "kcd-scripts build",
Expand All @@ -36,7 +34,7 @@
"test:debug": "kcd-scripts --inspect-brk test --runInBand",
"test:update": "npm test -- --updateSnapshot --coverage",
"validate": "kcd-scripts validate",
"typecheck": "kcd-scripts typecheck --build typings"
"typecheck": "kcd-scripts typecheck"
},
"dependencies": {
"@babel/runtime": "^7.12.5"
Expand Down
1 change: 1 addition & 0 deletions src/clear.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function clear(element: Element): void
4 changes: 3 additions & 1 deletion src/click.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ export declare interface clickOptions {
}

export declare function click(
element: TargetElement,
element: Element,
init?: MouseEventInit,
options?: clickOptions,
): void

export declare function dblClick(element: Element, init?: MouseEventInit): void
File renamed without changes.
5 changes: 3 additions & 2 deletions src/index.js → src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {click, dblClick} from './click'
import {type, specialCharMap} from './type'
import {type} from './type'
import {clear} from './clear'
import {tab} from './tab'
import {hover, unhover} from './hover'
import {upload} from './upload'
import {selectOptions, deselectOptions} from './select-options'
import {paste} from './paste'
import {keyboard} from './keyboard'
import {keyboard, specialCharMap} from './keyboard'

const userEvent = {
click,
Expand All @@ -26,3 +26,4 @@ const userEvent = {
export default userEvent

export {specialCharMap as specialChars}
export type {keyboardKey} from './keyboard'
9 changes: 9 additions & 0 deletions src/paste.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export declare function paste(
element: Element,
text: string,
init?: MouseEventInit,
pasteOptions?: {
initialSelectionStart?: number
initialSelectionEnd?: number
},
): void
11 changes: 11 additions & 0 deletions src/select-options.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export declare function selectOptions(
element: Element,
values: HTMLElement | HTMLElement[] | string[] | string,
init?: MouseEventInit,
): void

export declare function deselectOptions(
element: Element,
values: HTMLElement | HTMLElement[] | string[] | string,
init?: MouseEventInit,
): void
6 changes: 6 additions & 0 deletions src/tab.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interface tabOptions {
shift?: boolean
focusTrap?: Document | Element
}

export declare function tab(userOpts?: tabOptions): void
15 changes: 15 additions & 0 deletions src/upload.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
interface uploadInit {
clickInit?: MouseEventInit
changeInit?: Event
}

interface uploadOptions {
applyAccept?: boolean
}

export declare function upload(
element: Element,
files: File | File[],
init?: uploadInit,
options?: uploadOptions,
): void
5 changes: 0 additions & 5 deletions typings/.eslintrc

This file was deleted.

73 changes: 0 additions & 73 deletions typings/index.d.ts

This file was deleted.

10 changes: 0 additions & 10 deletions typings/test.ts

This file was deleted.

4 changes: 0 additions & 4 deletions typings/tsconfig.json

This file was deleted.

0 comments on commit 16314c6

Please sign in to comment.