Skip to content

Commit

Permalink
Fix function parameter types
Browse files Browse the repository at this point in the history
  • Loading branch information
georgecwan committed Oct 20, 2023
1 parent 971ccba commit 41bd916
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 15 deletions.
7 changes: 5 additions & 2 deletions packages/code-studio/src/styleguide/MockIrisGridTreeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MockIrisGridTreeModel
return this.isEditable;
}

setValues(edits: EditOperation[]): never {
setValues(edits: readonly EditOperation[]): never {
throw new Error('Method not implemented.');
}

Expand Down Expand Up @@ -259,7 +259,10 @@ class MockIrisGridTreeModel
);
}

async setValueForRanges(ranges: GridRange[], text: string): Promise<void> {
async setValueForRanges(
ranges: readonly GridRange[],
text: string
): Promise<void> {
GridRange.forEachCell(ranges, (x, y) => {
this.setValueForCell(x, y, text);
});
Expand Down
7 changes: 5 additions & 2 deletions packages/grid/src/MockGridModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,16 @@ class MockGridModel extends GridModel implements EditableGridModel {
this.editedData[column][row] = `${value}`;
}

async setValueForRanges(ranges: GridRange[], text: string): Promise<void> {
async setValueForRanges(
ranges: readonly GridRange[],
text: string
): Promise<void> {
GridRange.forEachCell(ranges, (x, y) => {
this.setValueForCell(x, y, text);
});
}

async setValues(edits: EditOperation[]): Promise<void> {
async setValues(edits: readonly EditOperation[]): Promise<void> {
for (let i = 0; i < edits.length; i += 1) {
const edit = edits[i];
this.setValueForCell(
Expand Down
4 changes: 2 additions & 2 deletions packages/iris-grid/src/IrisGridModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DataBarOptions,
GridModel,
GridRange,
GridThemeType,
ModelIndex,
MoveOperation,
VisibleIndex,
Expand All @@ -31,7 +32,6 @@ import {
PendingDataErrorMap,
} from './CommonTypes';
import ColumnHeaderGroup from './ColumnHeaderGroup';
import { IrisGridThemeType } from './IrisGridTheme';

type IrisGridModelEventNames =
(typeof IrisGridModel.EVENT)[keyof typeof IrisGridModel.EVENT];
Expand Down Expand Up @@ -542,7 +542,7 @@ abstract class IrisGridModel<
dataBarOptionsForCell(
column: number,
row: number,
theme: IrisGridThemeType
theme: GridThemeType
): DataBarOptions {
throw new Error('Method not implemented.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ type VisibilityOrderingItemProps = {
childCount: number;
item: FlattenedIrisGridTreeItem;
onVisibilityChange: (modelIndexes: number[], isVisible: boolean) => void;
onClick: (name: string, event: React.MouseEvent) => void;
onClick: (
name: string,
event: React.MouseEvent<HTMLElement, MouseEvent>
) => void;
onGroupDelete: (group: ColumnHeaderGroup) => void;
onGroupColorChange: (
group: ColumnHeaderGroup,
color: string | undefined
) => void;
onGroupNameChange: (group: ColumnHeaderGroup, name: string) => void;
validateGroupName: (name: string) => string;
handleProps: Record<string, unknown>;
handleProps?: Record<string, unknown>;
};

function emptyOnClick(): void {
Expand Down Expand Up @@ -60,7 +63,7 @@ const VisibilityOrderingItem = forwardRef<
);

const handleClick = useCallback(
(event: React.MouseEvent) => {
(event: React.MouseEvent<HTMLElement, MouseEvent>) => {
onClick(value, event);
},
[onClick, value]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ interface Props<T> {
childCount?: number;
value: string;
item: FlattenedItem<T>;
ref: React.Ref<HTMLDivElement> | null;
handleProps?: Record<string, unknown>;
}) => JSX.Element;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ interface Props<T> {
childCount?: number;
value: string;
item: FlattenedItem<T>;
ref: React.Ref<HTMLDivElement> | null;
handleProps?: Record<string, unknown>;
}) => JSX.Element;
activeId: string | null;
overId: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface Props<T> {
depth: number;
disableInteraction?: boolean;
ghost?: boolean;
handleProps?: unknown;
handleProps?: Record<string, unknown>;
value: string;
item: FlattenedItem<T>;
dragRef?: React.Ref<HTMLDivElement> | null;
Expand All @@ -21,7 +21,7 @@ export interface Props<T> {
childCount?: number;
value: string;
item: FlattenedItem<T>;
handleProps: unknown;
handleProps?: Record<string, unknown>;
}) => JSX.Element;
}

Expand All @@ -31,7 +31,7 @@ export type TreeItemRenderFn<T> = (props: {
childCount?: number;
value: string;
item: T extends TreeItemType<infer D> ? FlattenedItem<D> : FlattenedItem<T>;
handleProps: Record<string, unknown>;
handleProps?: Record<string, unknown>;
}) => JSX.Element;

export function TreeItem<T>(props: Props<T>): JSX.Element {
Expand Down
5 changes: 2 additions & 3 deletions packages/pouch-storage/src/PouchStorageTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
StorageSnapshot,
ViewportData,
ViewportUpdateCallback,
IndexRange,
} from '@deephaven/storage';
import { CancelablePromise, OnlyOneProp, PromiseUtils } from '@deephaven/utils';

Expand Down Expand Up @@ -426,9 +427,7 @@ export class PouchStorageTable<T extends StorageItem = StorageItem>
return item;
}

async getSnapshot(
sortedRanges: [number, number][]
): Promise<StorageSnapshot<T>> {
async getSnapshot(sortedRanges: IndexRange[]): Promise<StorageSnapshot<T>> {
const itemMap = new Map();

const sort: PouchDBSort = [{ id: this.currentReverse ? 'desc' : 'asc' }];
Expand Down

0 comments on commit 41bd916

Please sign in to comment.