Skip to content

Commit

Permalink
build: TypeScript fixes (#1392)
Browse files Browse the repository at this point in the history
- JS to TS conversion fixes found from doing Enterprise conversion
  • Loading branch information
mofojed authored Jun 30, 2023
1 parent b66c0de commit 235c3a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/components/src/context-actions/ContextActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ContextActions extends Component<
* Items within groups are ordered by their order property, then by their title.
*/
static groups = {
default: null,
default: undefined,
high: 100,
medium: 5000,
low: 10000,
Expand Down
2 changes: 1 addition & 1 deletion packages/storage/src/Storage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type FilterValue = number | string;
export type FilterValue = number | string | string[];

export type FilterConfigItem = {
columnName: string;
Expand Down
26 changes: 13 additions & 13 deletions packages/storage/src/StorageTableViewportUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import {
ViewportUpdateCallback,
} from './Storage';

export type StorageTableViewportUpdaterProps = {
table: StorageTable<StorageItem>;
export type StorageTableViewportUpdaterProps<T extends StorageItem> = {
table: StorageTable<T>;
columns?: string[];
top?: number;
bottom?: number;
filters?: FilterConfig[];
sorts?: SortConfig[];
isReversed?: boolean;
onUpdate: ViewportUpdateCallback<StorageItem>;
onUpdate: ViewportUpdateCallback<T>;
};

const UPDATE_DELAY = 150;
Expand All @@ -28,7 +28,9 @@ const ROW_BUFFER_PAGES = 3;

const log = Log.module('StorageTableViewportUpdater');

export function StorageTableViewportUpdater({
export function StorageTableViewportUpdater<
T extends StorageItem = StorageItem
>({
table,
columns,
top = 0,
Expand All @@ -37,7 +39,7 @@ export function StorageTableViewportUpdater({
sorts,
isReversed = false,
onUpdate,
}: StorageTableViewportUpdaterProps): null {
}: StorageTableViewportUpdaterProps<T>): null {
const throttledUpdateViewport = useMemo(
() =>
throttle((viewport: StorageTableViewport) => {
Expand All @@ -59,14 +61,12 @@ export function StorageTableViewportUpdater({

useEffect(
function updateViewportAndReturnCleanup() {
const cleanup = table.onUpdate(
(viewportData: ViewportData<StorageItem>) => {
onUpdate({
items: viewportData.items ?? [],
offset: viewportData.offset ?? 0,
});
}
);
const cleanup = table.onUpdate((viewportData: ViewportData<T>) => {
onUpdate({
items: viewportData.items ?? [],
offset: viewportData.offset ?? 0,
});
});

return () => {
log.debug('onUpdate cleanup');
Expand Down

0 comments on commit 235c3a2

Please sign in to comment.