From 9bb6b1e049bf4dacde314b3459e423186c1d8d70 Mon Sep 17 00:00:00 2001 From: James Munro Date: Tue, 8 Dec 2020 18:00:32 +0000 Subject: [PATCH] Add a TypeScript module definition. --- index.d.ts | 23 +++++++++++++++++++++++ package.json | 2 ++ 2 files changed, 25 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..27ddf97 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,23 @@ +type SpotlightItem = { + title: string + contentDescription?: string + uniqueIdentifier: string + domain: string + thumbnailName?: string + thumbnailData?: string + keywords?: string[] +} + +export function indexItems(items: SpotlightItem[]): Promise + +export function indexItem(item: SpotlightItem): Promise + +export function deleteItemsWithIdentifiers(itemIdentifiers: string[]): Promise; + +export function deleteItemsInDomains(itemDomains: string[]): Promise; + +export function deleteAllItems(): Promise + +export function searchItemTapped(callback: (uniqueIdentifier: string) => void): void; + +export function getInitialSearchItem(): Promise \ No newline at end of file diff --git a/package.json b/package.json index 1f84abb..20ac609 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,10 @@ "version": "1.3.0", "description": "A React Native module for iOS that provides Spotlight search functionality.", "main": "index.js", + "types": "index.d.ts", "files": [ "index.js", + "index.d.ts", "ios/*", "react-native-spotlight-search.podspec" ],