From 73f751f90f1a4f1535f26a4f8862e9ba5194a626 Mon Sep 17 00:00:00 2001 From: Jusung Hwang Date: Thu, 14 Jul 2022 01:58:59 +0900 Subject: [PATCH] fix: fix gap value type and add optional chaining (#711) --- src/Grid.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Grid.tsx b/src/Grid.tsx index 1d5241834..9c9eef7c5 100644 --- a/src/Grid.tsx +++ b/src/Grid.tsx @@ -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) }