Skip to content

Commit

Permalink
fix: type errors in iapexample
Browse files Browse the repository at this point in the history
now properly linked with parent project
  • Loading branch information
Arthur Geron committed Nov 13, 2023
1 parent bd2e42e commit 12c5226
Show file tree
Hide file tree
Showing 4 changed files with 273 additions and 18 deletions.
1 change: 1 addition & 0 deletions IapExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"react": "18.2.0",
"react-native": "^0.72.6",
"react-native-gesture-handler": "^2.12.0",
"react-native-iap": "portal:../",
"react-native-safe-area-context": "^4.5.3",
"react-native-screens": "^3.21.0"
},
Expand Down
21 changes: 18 additions & 3 deletions IapExample/src/screens/ClassSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ export class ClassSetup extends Component<{}, State> {
}
} catch (error) {
if (error instanceof PurchaseError) {
errorLog({message: `[${error.code}]: ${error.message}`, error});
errorLog({
message: `[${(error as PurchaseError).code}]: ${
(error as PurchaseError).message
}`,
error,
});
} else {
errorLog({message: 'finishTransaction', error});
}
Expand Down Expand Up @@ -167,7 +172,12 @@ export class ClassSetup extends Component<{}, State> {
requestPurchase({sku});
} catch (error) {
if (error instanceof PurchaseError) {
errorLog({message: `[${error.code}]: ${error.message}`, error});
errorLog({
message: `[${(error as PurchaseError).code}]: ${
(error as PurchaseError).message
}`,
error,
});
} else {
errorLog({message: 'requestPurchase', error});
}
Expand All @@ -179,7 +189,12 @@ export class ClassSetup extends Component<{}, State> {
requestSubscription({sku});
} catch (error) {
if (error instanceof PurchaseError) {
errorLog({message: `[${error.code}]: ${error.message}`, error});
errorLog({
message: `[${(error as PurchaseError).code}]: ${
(error as PurchaseError).message
}`,
error,
});
} else {
errorLog({message: 'requestSubscription', error});
}
Expand Down
8 changes: 7 additions & 1 deletion IapExample/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"extends": "@tsconfig/react-native/tsconfig.json"
"extends": "@tsconfig/react-native/tsconfig.json",
"compilerOptions": {
"baseUrl": "./",
"paths": {
"react-native-iap": ["../src/index"]
},
}
}
Loading

0 comments on commit 12c5226

Please sign in to comment.