Skip to content

Commit

Permalink
fix: fix gap value type and add optional chaining (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
nabigraphics committed Jul 13, 2022
1 parent 3442b0c commit 73f751f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ export { Grid }
const Scroller = buildScroller({ usePublisher, useEmitterValue, useEmitter })
const WindowScroller = buildWindowScroller({ usePublisher, useEmitterValue, useEmitter })

function resolveGapValue(property: string, value: string, log: Log) {
if (value !== 'normal' && !value.endsWith('px')) {
function resolveGapValue(property: string, value: string | undefined, log: Log) {
if (value !== 'normal' && !value?.endsWith('px')) {
log(`${property} was not resolved to pixel value correctly`, value, LogLevel.WARN)
}
if (value === 'normal') {
return 0
}
return parseInt(value, 10)
return parseInt(value ?? '0', 10)
}

0 comments on commit 73f751f

Please sign in to comment.