Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #69

Merged
merged 2 commits into from
May 27, 2024
Merged

Update README.md #69

merged 2 commits into from
May 27, 2024

Conversation

nurbxfit
Copy link
Contributor

Update the example code
from:

 if (ticket.id) {
    receiptIds.push(ticket.id);
  }

to

 if (ticket.status == "ok") { // doing this help with typescript error
  receiptIds.push(ticket.id)
}

The typescript Error:

Property 'id' does not exist on type 'ExpoPushTicket'.
Property 'id' does not exist on type 'ExpoPushErrorReceipt'.

this is due to the type being declare like this

export type ExpoPushReceiptId = string;

export type ExpoPushSuccessTicket = {
  status: 'ok';
  id: ExpoPushReceiptId;
};

export type ExpoPushErrorTicket = ExpoPushErrorReceipt;

export type ExpoPushTicket = ExpoPushSuccessTicket | ExpoPushErrorTicket;

in src/ExpoClient.ts

the id surely exist if the status == 'ok'

Update the example code 
from: 
```ts
 if (ticket.id) {
    receiptIds.push(ticket.id);
  }
```
to 
```ts
 if (ticket.status == "ok") { // doing this help with typescript error
  receiptIds.push(ticket.id)
}
```
The typescript Error: 
```
Property 'id' does not exist on type 'ExpoPushTicket'.
Property 'id' does not exist on type 'ExpoPushErrorReceipt'.
```
this is due to the type being declare like this 
```ts
export type ExpoPushReceiptId = string;

export type ExpoPushSuccessTicket = {
  status: 'ok';
  id: ExpoPushReceiptId;
};

export type ExpoPushErrorTicket = ExpoPushErrorReceipt;

export type ExpoPushTicket = ExpoPushSuccessTicket | ExpoPushErrorTicket;
```
in `src/ExpoClient.ts`
README.md Outdated Show resolved Hide resolved
@ide ide merged commit f866215 into expo:main May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants