Skip to content

Commit

Permalink
fix: type-tests error in TS >= 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
FaberVitale committed Jun 12, 2022
1 parent e0ed0cb commit 38c4631
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions packages/toolkit/setup-type-tests.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
// Not available on old TS versions but used by `@testing-library/user-event`
// Patches types not available on old TS versions but is used by `@testing-library/user-event`.
// @see https://stackoverflow.com/a/61505395
declare class ClipboardItem {
constructor(data: { [mimeType: string]: Blob })
declare module 'lib.dom.ts' {
type ClipboardItemData = Promise<ClipboardItemDataType>;
type ClipboardItemDataType = string | Blob;
type PresentationStyle = "attachment" | "inline" | "unspecified";

interface ClipboardItemOptions {
presentationStyle?: PresentationStyle;
}

interface ClipboardItem {
readonly types: ReadonlyArray<string>
getType(type: string): Promise<Blob>
}

var ClipboardItem: {
prototype: ClipboardItem
new (
items: Record<string, ClipboardItemData>,
options?: ClipboardItemOptions
): ClipboardItem
}
}

0 comments on commit 38c4631

Please sign in to comment.