Skip to content

Commit 38c4631

Browse files
committed
fix: type-tests error in TS >= 4.4
1 parent e0ed0cb commit 38c4631

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed
+22-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1-
// Not available on old TS versions but used by `@testing-library/user-event`
1+
// Patches types not available on old TS versions but is used by `@testing-library/user-event`.
22
// @see https://stackoverflow.com/a/61505395
3-
declare class ClipboardItem {
4-
constructor(data: { [mimeType: string]: Blob })
3+
declare module 'lib.dom.ts' {
4+
type ClipboardItemData = Promise<ClipboardItemDataType>;
5+
type ClipboardItemDataType = string | Blob;
6+
type PresentationStyle = "attachment" | "inline" | "unspecified";
7+
8+
interface ClipboardItemOptions {
9+
presentationStyle?: PresentationStyle;
10+
}
11+
12+
interface ClipboardItem {
13+
readonly types: ReadonlyArray<string>
14+
getType(type: string): Promise<Blob>
15+
}
16+
17+
var ClipboardItem: {
18+
prototype: ClipboardItem
19+
new (
20+
items: Record<string, ClipboardItemData>,
21+
options?: ClipboardItemOptions
22+
): ClipboardItem
23+
}
524
}

0 commit comments

Comments
 (0)