Skip to content

Commit

Permalink
Merge pull request #6 from wwdrew/add-typescript-definitions
Browse files Browse the repository at this point in the history
Add TypeScript definitions
  • Loading branch information
juliandramirez committed Apr 15, 2022
2 parents 1224cea + fdb540a commit 7551c21
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
32 changes: 32 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Type definitions for react-native-user-identity 1.5.1
// Project: https://github.com/juliandramirez/react-native-user-identity
// Definitions by: wwdrew <https://github.com/wwdrew>
// TypeScript Version: 3.8

declare module "react-native-user-identity" {

export const ICLOUD_ACCESS_ERROR: string;

type IosUserConfirmationOptions = {
title?: string;
message?: string;
signInButtonText?: string;
cancelButtonText?: string;
}

export type UserIdOptions = {
iosUserConfirmation?: boolean | IosUserConfirmationOptions;
androidAccountSelectionMessage?: string;
}

const RNUserIdentity: RNUserIdentity;

export interface RNUserIdentity {
/**
* Get the user ID value.
*/
getUserId(options: UserIdOptions): Promise<string | null>;
}

export default RNUserIdentity;
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.5.1",
"description": "Get the user id configured for the device (iCloud recordID for iOS, email of a device account for android)",
"main": "index.js",
"types": "index.d.ts",
"author": "Julian Ramírez <[email protected]>",
"homepage": "https://github.com/juliandramirez/react-native-user-identity",
"license": "Apache-2.0",
Expand Down Expand Up @@ -41,7 +42,7 @@
"account",
"intent",
"newChooseAccountIntent",
"KEY_ACCOUNT_NAME"
"KEY_ACCOUNT_NAME"
],
"peerDependencies": {
"react-native": ">=0.60.0",
Expand Down

0 comments on commit 7551c21

Please sign in to comment.