mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-07 02:30:12 +00:00
Merge pull request #34744 from johngeorgewright/feature/react-native-app-link
feat: 🎸 add react-native-app-link types
This commit is contained in:
22
types/react-native-app-link/index.d.ts
vendored
Normal file
22
types/react-native-app-link/index.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Type definitions for react-native-app-link 1.0
|
||||
// Project: https://github.com/datwheat/react-native-app-link#readme
|
||||
// Definitions by: John Wright <https://github.com/johngeorgewright>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface AppLinkOptions {
|
||||
readonly appName: string;
|
||||
readonly appStoreId: number;
|
||||
readonly appStoreLocale: string;
|
||||
readonly playStoreId: string;
|
||||
}
|
||||
|
||||
declare namespace AppLink {
|
||||
function maybeOpenURL(url: string, options: AppLinkOptions): Promise<void>;
|
||||
function openInStore(options: AppLinkOptions): Promise<void>;
|
||||
}
|
||||
|
||||
export default AppLink;
|
||||
|
||||
import maybeOpenURL = AppLink.maybeOpenURL;
|
||||
import openInStore = AppLink.openInStore;
|
||||
export { maybeOpenURL, openInStore };
|
||||
37
types/react-native-app-link/react-native-app-link-tests.ts
Normal file
37
types/react-native-app-link/react-native-app-link-tests.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import AppLink, { maybeOpenURL, openInStore } from 'react-native-app-link';
|
||||
|
||||
AppLink.maybeOpenURL('instagram://user?username=microsoft', {
|
||||
appName: 'instagram',
|
||||
appStoreId: 389801252,
|
||||
appStoreLocale: 'gb',
|
||||
playStoreId: 'com.instagram.android'
|
||||
}).then(() => {
|
||||
// do stuff
|
||||
});
|
||||
|
||||
maybeOpenURL('instagram://user?username=microsoft', {
|
||||
appName: 'instagram',
|
||||
appStoreId: 389801252,
|
||||
appStoreLocale: 'gb',
|
||||
playStoreId: 'com.instagram.android'
|
||||
}).then(() => {
|
||||
// do stuff
|
||||
});
|
||||
|
||||
AppLink.openInStore({
|
||||
appName: 'whatsapp-messenger',
|
||||
appStoreId: 310633997,
|
||||
appStoreLocale: 'gb',
|
||||
playStoreId: 'com.whatsapp'
|
||||
}).then(() => {
|
||||
// do stuff
|
||||
});
|
||||
|
||||
openInStore({
|
||||
appName: 'whatsapp-messenger',
|
||||
appStoreId: 310633997,
|
||||
appStoreLocale: 'gb',
|
||||
playStoreId: 'com.whatsapp'
|
||||
}).then(() => {
|
||||
// do stuff
|
||||
});
|
||||
23
types/react-native-app-link/tsconfig.json
Normal file
23
types/react-native-app-link/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-app-link-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/react-native-app-link/tslint.json
Normal file
1
types/react-native-app-link/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user