From 2f856b3a72296f4a771f3c53c1da23cbdf66e961 Mon Sep 17 00:00:00 2001 From: Jack <30497388+FieryFlames@users.noreply.github.com> Date: Sat, 4 Feb 2023 13:44:33 -0500 Subject: [PATCH] [TS] Type clipboard common module (#15) * [TS] Type clipboard common module * [TS] Add a _ to Clipboard for style --- package.json | 1 + pnpm-lock.yaml | 14 ++++++++++++++ src/def.d.ts | 3 ++- src/lib/metro/common.ts | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 646dbb6..8fac1d9 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "author": "Beef", "license": "BSD-3-Clause", "devDependencies": { + "@react-native-clipboard/clipboard": "1.10.0", "@types/react": "18.0.27", "@types/react-native": "0.70.6", "esbuild": "^0.17.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e546519..68cd8be 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,6 +1,7 @@ lockfileVersion: 5.4 specifiers: + '@react-native-clipboard/clipboard': ^1.10.0 '@types/react': 18.0.27 '@types/react-native': 0.70.6 esbuild: ^0.17.5 @@ -14,6 +15,7 @@ dependencies: spitroast: 1.4.2 devDependencies: + '@react-native-clipboard/clipboard': 1.10.0 '@types/react': 18.0.27 '@types/react-native': 0.70.6 esbuild: 0.17.5 @@ -222,6 +224,18 @@ packages: dev: true optional: true + /@react-native-clipboard/clipboard/1.10.0: + resolution: {integrity: sha512-1L+I0vmeUJgMi8MnNsqI00391/RFLkmmxj9qAuOS2madpvce/oNqJb8Pwk2Fc/uxIJSxOckTpq+dQwyPU6s+7w==} + peerDependencies: + react: '>=16.0' + react-native: '>=0.57.0' + peerDependenciesMeta: + react: + optional: true + react-native: + optional: true + dev: true + /@types/prop-types/15.7.5: resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} dev: true diff --git a/src/def.d.ts b/src/def.d.ts index fd4227f..948dadf 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -1,6 +1,7 @@ import * as _spitroast from "spitroast"; import _React from "react"; import _RN from "react-native"; +import _Clipboard from "@react-native-clipboard/clipboard"; type MetroModules = { [id: number]: any }; @@ -217,7 +218,7 @@ interface VendettaObject { url: PropIntellisense<"openURL">; toasts: PropIntellisense<"open" | "close">; stylesheet: PropIntellisense<"createThemedStyleSheet">; - clipboard: PropIntellisense<"setString" | "getString" | "hasString">; + clipboard: typeof _Clipboard; assets: PropIntellisense<"registerAsset">; invites: PropIntellisense<"acceptInviteAndTransitionToInviteChannel">; commands: PropIntellisense<"getBuiltInCommands">; diff --git a/src/lib/metro/common.ts b/src/lib/metro/common.ts index 6ae049d..12f678d 100644 --- a/src/lib/metro/common.ts +++ b/src/lib/metro/common.ts @@ -7,7 +7,7 @@ export const i18n = findByProps("Messages"); export const url = findByProps("openURL"); export const toasts = find(m => m.open && m.close && !m.startDrag && !m.init && !m.openReplay && !m.setAlwaysOnTop); export const stylesheet = findByProps("createThemedStyleSheet"); -export const clipboard = findByProps("setString", "getString", "hasString"); +export const clipboard = findByProps("setString", "getString", "hasString") as typeof import("@react-native-clipboard/clipboard").default; export const assets = findByProps("registerAsset"); export const invites = findByProps("acceptInviteAndTransitionToInviteChannel"); export const commands = findByProps("getBuiltInCommands");