mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-04 19:42:46 +08:00
[react-native-fabric] Add typings for react-native-fabric
This commit is contained in:
70
types/react-native-fabric/index.d.ts
vendored
Normal file
70
types/react-native-fabric/index.d.ts
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
// Type definitions for react-native-fabric 0.5
|
||||
// Project: https://github.com/corymsmith/react-native-fabric
|
||||
// Definitions by: Joseph Roque <https://github.com/josephroque>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface CustomAttributes {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export namespace Answers {
|
||||
function logCustom(eventName: string, customAttributes?: CustomAttributes): void;
|
||||
function logInvite(method: string, customAttributes?: CustomAttributes): void;
|
||||
function logLevelStart(levelName: string, customAttributes?: CustomAttributes): void;
|
||||
function logLevelEnd(levelName: string, customAttributes?: CustomAttributes): void;
|
||||
function logLogin(method: string, success: boolean, customAttributes?: CustomAttributes): void;
|
||||
function logSearch(query: string, customAttributes?: CustomAttributes): void;
|
||||
function logSignUp(method: string, success: boolean, customAttributes?: CustomAttributes): void;
|
||||
function logShare(
|
||||
method: string,
|
||||
contentName: string,
|
||||
contentType: string,
|
||||
contentId: string,
|
||||
customAttributes?: CustomAttributes): void;
|
||||
function logStartCheckout(
|
||||
totalPrice: number,
|
||||
count: number,
|
||||
currency: string,
|
||||
customAttributes?: CustomAttributes): void;
|
||||
function logAddToCart(
|
||||
itemPrice: number,
|
||||
currency: string,
|
||||
itemName: string,
|
||||
itemType: string,
|
||||
itemId: string,
|
||||
customAttributes?: CustomAttributes): void;
|
||||
function logPurchase(
|
||||
itemPrice: number,
|
||||
currency: string,
|
||||
success: boolean,
|
||||
itemName: string,
|
||||
itemType: string,
|
||||
itemId: string,
|
||||
customAttributes?: CustomAttributes): void;
|
||||
function logContentView(
|
||||
contentName: string,
|
||||
contentType: string,
|
||||
contentId: string,
|
||||
customAttributes?: CustomAttributes): void;
|
||||
function logRating(
|
||||
rating: number,
|
||||
contentId: string,
|
||||
contentType: string,
|
||||
contentName: string,
|
||||
customAttributes?: CustomAttributes): void;
|
||||
}
|
||||
|
||||
export namespace Crashlytics {
|
||||
function crash(): void;
|
||||
function throwException(): void;
|
||||
function recordError(error: any): void;
|
||||
function logException(value: string): void;
|
||||
function log(message: string): void;
|
||||
function setUserEmail(email: string | null): void;
|
||||
function setUserIdentifier(id: string | null): void;
|
||||
function setUserName(userName: string | null): void;
|
||||
function setBool(key: string, value: boolean): void;
|
||||
function setNumber(key: string, value: number): void;
|
||||
function setString(key: string, value: string): void;
|
||||
function recordCustomExceptionName(name: string, reason: string, stack?: any[]): void;
|
||||
}
|
||||
7
types/react-native-fabric/react-native-fabric-tests.ts
Normal file
7
types/react-native-fabric/react-native-fabric-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Answers, Crashlytics } from 'react-native-fabric';
|
||||
|
||||
Answers.logSearch('query');
|
||||
Answers.logCustom('event', { customKey: 0 });
|
||||
|
||||
Crashlytics.crash();
|
||||
Crashlytics.setUserName('name');
|
||||
25
types/react-native-fabric/tsconfig.json
Normal file
25
types/react-native-fabric/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"noUnusedParameters": true,
|
||||
"noUnusedLocals": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-fabric-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/react-native-fabric/tslint.json
Normal file
1
types/react-native-fabric/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user