Skip to content

Commit

Permalink
Upgraded TypeScript to 5.6.2 (#2222)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Sep 17, 2024
1 parent 1d027d3 commit 36e0497
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 47 deletions.
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
2 changes: 1 addition & 1 deletion packages/components/src/BulkActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function BulkActionBar({
selectedItemCount={selectedItemCount}
onClearSelection={onClearSelection}
>
{/* */}
<span />
</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
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) {
case type: {
const { id, payload } = action;
if (checkIfChanged && deepEqual({ payload }, { payload: state[id] })) {
Expand Down
2 changes: 1 addition & 1 deletion packages/redux/src/reducers/common/replaceReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function replaceReducer<S>(
initialState: S
): Reducer<S> {
return (state = initialState, action?) => {
switch (action.type) {
switch (action?.type) {
case type: {
return action.payload;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/utils/src/EventTargetShimUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { Event, EventTarget } from 'event-target-shim';

export type EventT<T extends string = string> = Event<T>;

/**
* A CustomEvent extension which combines the browser CustomEvent and event-target-shim's Event types for type safety
* CustomEvent does not have a generic type and augmenting the dom types seemed like not the best idea
Expand Down

0 comments on commit 36e0497

Please sign in to comment.