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

[MM-898]: Fixed TS errors in multiple webapp files #1133

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion webapp/src/components/jira_fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class JiraFields extends React.Component<Props> {
return null;
}

let projectKey;
let projectKey: string | undefined;
if (values && values.project) {
projectKey = values.project.key;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class ConnectModalForm extends PureComponent<Props, State> {
selectedInstance: '',
};

submit = async (e) => {
submit = async (e: React.FormEvent<HTMLFormElement>) => {
if (e.preventDefault) {
e.preventDefault();
}
Expand All @@ -49,7 +49,7 @@ export default class ConnectModalForm extends PureComponent<Props, State> {
return Boolean(this.props.connectedInstances.find((instance) => instance.instance_id === instanceID));
};

closeModal = (e) => {
closeModal = (e: React.FormEvent<HTMLFormElement>) => {
this.props.closeModal();
};

Expand Down
4 changes: 3 additions & 1 deletion webapp/src/components/modals/connect_modal/props.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import {Theme} from 'mattermost-redux/types/preferences';

import {Instance} from 'types/model';

export type Props = {
theme: {};
theme: Theme;
visible: boolean;
installedInstances: Instance[];
connectedInstances: Instance[];
Expand Down
8 changes: 4 additions & 4 deletions webapp/src/components/react_select_setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// See LICENSE.txt for license information.

import React from 'react';
import ReactSelect from 'react-select';
import ReactSelect, {GroupTypeBase} from 'react-select';
import AsyncSelect, {Props as ReactSelectProps} from 'react-select/async';
import CreatableSelect from 'react-select/creatable';

Expand All @@ -20,7 +20,7 @@ const MAX_NUM_OPTIONS = 100;

type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>

export type Props = Omit<ReactSelectProps<ReactSelectOption>, 'theme'> & {
export type Props = Omit<ReactSelectProps<ReactSelectOption, boolean, GroupTypeBase<ReactSelectOption>>, 'theme'> & {
theme: Theme;
addValidate?: (isValid: () => boolean) => void;
removeValidate?: (isValid: () => boolean) => void;
Expand Down Expand Up @@ -54,7 +54,7 @@ export default class ReactSelectSetting extends React.PureComponent<Props, State
}
}

handleChange = (value: ReactSelectOption | ReactSelectOption[], action: ActionMeta) => {
handleChange = (value: ReactSelectOption | ReactSelectOption[], action: ActionMeta<ReactSelectOption>) => {
if (this.props.onChange) {
if (Array.isArray(value)) {
this.props.onChange(this.props.name, value.map((x) => x.value));
Expand All @@ -72,7 +72,7 @@ export default class ReactSelectSetting extends React.PureComponent<Props, State
filterOptions = (input: string) => {
let options = this.props.options;
if (input) {
options = options.filter((opt: ReactSelectOption) => opt.label.toUpperCase().includes(input.toUpperCase()));
options = options.filter((opt: ReactSelectOption) => typeof opt.label === 'string' && opt.label.toUpperCase().includes(input.toUpperCase()));
}
return Promise.resolve(options.slice(0, MAX_NUM_OPTIONS));
};
Expand Down
Loading