Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Upgrade to TypeScript 5.6.2 #2226

Merged
merged 5 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 29 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"sass": "^1.39.0",
"source-map-explorer": "^2.5.2",
"stylelint": "^14.5.1",
"typescript": "~4.9.4",
"typescript": "~5.6.2",
"vite": "^5.4.2"
},
"prettier": "@deephaven/prettier-config",
Expand Down
10 changes: 8 additions & 2 deletions packages/components/src/BulkActionBar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import type { StyleProps } from '@react-types/shared';
import type { ItemElement, StyleProps } from '@react-types/shared';
import { ActionBar } from './spectrum';
import commonStyles from './SpectrumComponent.module.scss';

// The action bar will still show the item count + a clear selection button
// even if there are no actions. Our only consumer is currently the ACL Editor,
// but group action functionality has not yet been prioritized (see DH-15221).
// For now we'll just pass it an empty action items array.
const noActions: ItemElement<unknown>[] = [];

export interface BulkActionBarProps {
styleProps?: StyleProps;
selectedItemCount: 'all' | number;
Expand All @@ -22,7 +28,7 @@ export function BulkActionBar({
selectedItemCount={selectedItemCount}
onClearSelection={onClearSelection}
>
{/* */}
{noActions}
</ActionBar>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface ContextAction {
description?: string;
action?: (event: Event) => void;
actions?: ResolvableContextAction[];
icon?: IconDefinition | React.ReactElement;
icon?: IconDefinition | React.ReactElement<unknown>;
iconColor?: string;
shortcut?: Shortcut;

Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/spectrum/utils/itemUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ export function isNormalizedItemsWithKeysList<
return true;
}

return !isItemOrSection(node[0]) && 'key' in node[0];
return (
!isItemOrSection(node[0]) && typeof node[0] === 'object' && 'key' in node[0]
);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions packages/dashboard-core-plugins/src/panels/IrisGridPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {
import {
assertNotNull,
CancelablePromise,
EventT,
PromiseUtils,
} from '@deephaven/utils';
import { ResolvableContextAction } from '@deephaven/components';
Expand Down Expand Up @@ -703,7 +704,7 @@ export class IrisGridPanel extends PureComponent<
}
}

handleColumnsChanged(event: Event): void {
handleColumnsChanged(event: EventT): void {
const { isModelReady, model, modelQueue } = this.state;
if (isModelReady) {
this.sendColumnsChange((event as CustomEvent).detail);
Expand All @@ -713,7 +714,7 @@ export class IrisGridPanel extends PureComponent<
}
}

handleTableChanged(event: Event): void {
handleTableChanged(event: EventT): void {
log.debug('handleTableChanged', event);
const { glEventHub } = this.props;
const { detail: table } = event as CustomEvent;
Expand Down
3 changes: 2 additions & 1 deletion packages/iris-grid/src/IrisGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ import {
PromiseUtils,
ValidationError,
getOrThrow,
type EventT,
} from '@deephaven/utils';
import {
Type as FilterType,
Expand Down Expand Up @@ -3103,7 +3104,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
}));
}

handleRequestFailed(event: Event): void {
handleRequestFailed(event: EventT): void {
const { detail: error } = event as CustomEvent;
log.error('request failed:', error);
this.stopLoading();
Expand Down
4 changes: 2 additions & 2 deletions packages/iris-grid/src/sidebar/CustomColumnBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DragDropContext, Droppable, DropResult } from 'react-beautiful-dnd';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Button, DragUtils, LoadingSpinner } from '@deephaven/components';
import { dhNewCircleLargeFilled, vsWarning, vsPass } from '@deephaven/icons';
import { DbNameValidator } from '@deephaven/utils';
import { DbNameValidator, EventT } from '@deephaven/utils';
import CustomColumnInput from './CustomColumnInput';
import './CustomColumnBuilder.scss';
import IrisGridModel from '../IrisGridModel';
Expand Down Expand Up @@ -211,7 +211,7 @@ class CustomColumnBuilder extends Component<
);
}

handleRequestFailed(event: Event): void {
handleRequestFailed(event: EventT): void {
const customEvent = event as CustomEvent;
const { isCustomColumnApplying } = this.state;
if (!isCustomColumnApplying) {
Expand Down
11 changes: 8 additions & 3 deletions packages/log/src/LogProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,20 @@ export class LogProxy {
type: LOG_PROXY_TYPE,
listener: (event: CustomEvent<unknown[]>) => void
): void {
// The cast as EventListener is a dumb TypeScript issue
this.eventTarget.addEventListener(type, listener as EventListener);
this.eventTarget.addEventListener(
type,
listener as Parameters<EventTarget['addEventListener']>[1]
);
}

removeEventListener(
type: LOG_PROXY_TYPE,
listener: (event: CustomEvent<unknown[]>) => void
): void {
this.eventTarget.removeEventListener(type, listener as EventListener);
this.eventTarget.removeEventListener(
type,
listener as Parameters<EventTarget['removeEventListener']>[1]
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/PluginTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export interface WidgetPlugin<T = unknown> extends Plugin {
* If a react node is provided (including a string), it will be rendered directly.
* If no icon is specified, the default widget icon will be used.
*/
icon?: IconDefinition | React.ReactElement;
icon?: IconDefinition | React.ReactElement<unknown>;
}

export function isWidgetPlugin(plugin: PluginModule): plugin is WidgetPlugin {
Expand Down
2 changes: 1 addition & 1 deletion packages/redux/src/reducers/common/mergeReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function mergeReducer<S>(
initialState: S
): Reducer<S> {
return (state = initialState, action?) => {
switch (action.type) {
switch (action?.type) {
case type: {
const newState = action.payload;
if (newState == null) {
Expand Down
2 changes: 1 addition & 1 deletion packages/redux/src/reducers/common/replaceByIdReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function replaceByIdReducer<S extends Record<string, unknown>>(
checkIfChanged = true
): Reducer<S> {
return (state = initialState, action?) => {
switch (action.type) {
switch (action?.type) {
bmingles marked this conversation as resolved.
Show resolved Hide resolved
case type: {
const { id, payload } = action;
if (checkIfChanged && deepEqual({ payload }, { payload: state[id] })) {
Expand Down
Loading
Loading