Skip to content

Commit 60a26d1

Browse files
authored
chore: Fix linter errors (#104)
1 parent f813f87 commit 60a26d1

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/types.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,10 @@
55
* subset of node.js types, safe to use in browser and bundlers
66
* we do not use `lib.dom` types because they are not available in SSR environment
77
*/
8-
declare const process: { env: { NODE_ENV?: string } };
9-
declare const console: { warn: (...args: Array<any>) => void };
8+
declare global {
9+
const process: { env: { NODE_ENV?: string } };
10+
const console: { warn: (...args: Array<any>) => void };
11+
}
12+
13+
// dummy export to make typescript treat this file as ES module
14+
export {};

src/utils.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,22 @@ export function createActions<T>({
8484
return {
8585
setFiltering(filteringText) {
8686
dispatch({ type: 'filtering', filteringText });
87-
collectionRef.current && collectionRef.current.scrollToTop();
87+
collectionRef.current?.scrollToTop();
8888
},
8989
setSorting(state: SortingState<T>) {
9090
dispatch({ type: 'sorting', sortingState: state });
91-
collectionRef.current && collectionRef.current.scrollToTop();
91+
collectionRef.current?.scrollToTop();
9292
},
9393
setCurrentPage(pageIndex: number) {
9494
dispatch({ type: 'pagination', pageIndex });
95-
collectionRef.current && collectionRef.current.scrollToTop();
95+
collectionRef.current?.scrollToTop();
9696
},
9797
setSelectedItems(selectedItems: Array<T>) {
9898
dispatch({ type: 'selection', selectedItems });
9999
},
100100
setPropertyFiltering(query: PropertyFilterQuery) {
101101
dispatch({ type: 'property-filtering', query });
102-
collectionRef.current && collectionRef.current.scrollToTop();
102+
collectionRef.current?.scrollToTop();
103103
},
104104
setExpandedItems(expandedItems: ReadonlyArray<T>) {
105105
dispatch({ type: 'expansion', expandedItems });

0 commit comments

Comments
 (0)