Skip to content

Commit

Permalink
Update isExpoPushToken type signature (#36)
Browse files Browse the repository at this point in the history
* Update isExpoPushToken type signature

I think this is a better fit for what the function actually does: we don't know the type of the thing coming in, but we do know the type if it returns true.

https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates
  • Loading branch information
smichel17 authored Jun 29, 2020
1 parent 16144e3 commit ea03159
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ExpoClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class Expo {
/**
* Returns `true` if the token is an Expo push token
*/
static isExpoPushToken(token: ExpoPushToken): boolean {
static isExpoPushToken(token: unknown): token is ExpoPushToken {
return (
typeof token === 'string' &&
(((token.startsWith('ExponentPushToken[') || token.startsWith('ExpoPushToken[')) &&
Expand Down

0 comments on commit ea03159

Please sign in to comment.