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

[Chore]: Typescript 4.4 fixes #1957

Merged
merged 3 commits into from
Sep 11, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/actions/src/provider-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const resetProviderStatus: () => {
} = createAction(ActionTypes.RESET_PROVIDER_STATUS);

/** SET_CLOUD_PROVIDER */
export type SetCloudProviderPayload = string;
export type SetCloudProviderPayload = string | null;
export const setCloudProvider: (
p: SetCloudProviderPayload
) => {
Expand Down
6 changes: 5 additions & 1 deletion src/components/common/item-selector/typeahead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,11 @@ class Typeahead extends Component<TypeaheadProps, TypeaheadState> {
}

getSelection() {
let index = Number(this.state.selectionIndex);
let index: number | null = this.state.selectionIndex;
if (index === null) {
return null;
}
index = Number(index);

if (this._hasCustomValue()) {
if (index === 0) {
Expand Down
8 changes: 7 additions & 1 deletion src/components/map/map-popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ function createVirtualReference(container, x, y, size = 0) {
right: left + size,
bottom: top + size,
width: size,
height: size
height: size,
// These properties are present to meet the DOMRect interface
y: top,
x: left,
toJSON() {
return this;
}
};
}

Expand Down
12 changes: 6 additions & 6 deletions src/components/modals/cloud-tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import React, {ReactNode} from 'react';
import React from 'react';
import styled from 'styled-components';
import {Logout, Login} from 'components/common/icons';
import {CenterVerticalFlexbox, Button, CheckMark} from 'components/common/styled-components';
Expand Down Expand Up @@ -97,7 +97,7 @@ const LogoutButton = ({onClick}: OnClickProps) => (

interface ActionButtonProps {
isConnected?: boolean;
actionName?: ReactNode | null;
actionName?: string | null;
isReady?: boolean;
}

Expand All @@ -111,15 +111,15 @@ const ActionButton = ({isConnected, actionName = null, isReady}: ActionButtonPro
interface CloudTileProps {
onSelect?: React.MouseEventHandler<HTMLDivElement>;
// default to login
onConnect?: React.MouseEventHandler<HTMLDivElement> | null;
onConnect?: (() => void) | null;
// default to logout
onLogout?: React.MouseEventHandler<HTMLDivElement> | null;
onLogout?: (() => void) | null;
// action name
actionName?: ReactNode | null;
actionName?: string | null;
// cloud provider class
cloudProvider: Provider;
// function to take after login or logout
onSetCloudProvider;
onSetCloudProvider: (providerName: string | null) => void;
// whether provider is selected as currentProvider
isSelected?: boolean;
// whether user has logged in
Expand Down
11 changes: 6 additions & 5 deletions src/reducers/table-utils/kepler-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,18 +586,19 @@ export function pinTableColumns(dataset: KeplerTable, column: string): KeplerTab
// @ts-ignore
return copyTableAndUpdate(dataset, {pinnedColumns});
}
export function copyTable<T extends KeplerTable>(original: T): T {

export function copyTable(original: KeplerTable): KeplerTable {
return Object.assign(Object.create(Object.getPrototypeOf(original)), original);
}

/**
* @type
* @returns
*/
export function copyTableAndUpdate<T extends KeplerTable>(
original: T,
options: Partial<T> = {}
): T {
export function copyTableAndUpdate(
original: KeplerTable,
options: Partial<KeplerTable> = {}
): KeplerTable {
return Object.entries(options).reduce((acc, entry) => {
acc[entry[0]] = entry[1];
return acc;
Expand Down