Skip to content

Commit

Permalink
Narrower type for expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipeTrost committed Oct 23, 2023
1 parent c69a17a commit c6b961f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ rolesRouter.put('/:id', validateRole, isAllowed('update', 'Role'), async (req, r
try {
// validateRole turns expiration into a Date, in order for the object merge
// to work, we need it to be a string (type safe option in mergeIntoObject)
if (typeof role.expiration === 'object') {
if (role.expiration !== null && typeof role.expiration === 'object') {
/** @type {Date} */
const expirationDate = role.expiration;
role.expiration = expirationDate.toISOString();
Expand Down

0 comments on commit c6b961f

Please sign in to comment.