Skip to content

Commit

Permalink
Add type arg
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Nov 11, 2023
1 parent 7f2f3af commit 5592b45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ const actionAttempt = await seam.locks.unlockDoor({
try {
await resolveActionAttempt(actionAttempt, seam)
} catch (err: unknown) {
if (isSeamActionAttemptFailedError(err)) {
if (isSeamActionAttemptFailedError<typeof actionAttempt>(err)) {
console.log('Could not unlock the door')
return
}

if (isSeamActionAttemptTimeoutError(err)) {
if (isSeamActionAttemptTimeoutError<typeof actionAttempt>(err)) {
console.log('Door took too long to unlock')
return
}
Expand Down
4 changes: 2 additions & 2 deletions examples/unlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ export const handler: Handler<Options> = async ({ deviceId, seam, logger }) => {
)
logger.info({ actionAttempt: sucessfulActionAttempt }, 'unlocked')
} catch (err: unknown) {
if (isSeamActionAttemptFailedError(err)) {
if (isSeamActionAttemptFailedError<typeof actionAttempt>(err)) {
logger.info({ err }, 'Could not unlock the door')
return
}

if (isSeamActionAttemptTimeoutError(err)) {
if (isSeamActionAttemptTimeoutError<typeof actionAttempt>(err)) {
logger.info({ err }, 'Door took too long to unlock')
return
}
Expand Down

0 comments on commit 5592b45

Please sign in to comment.