Skip to content

feat(ts): Add Client type to withAPI #14475

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

Merged
merged 2 commits into from
Aug 21, 2019
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
5 changes: 2 additions & 3 deletions src/sentry/static/sentry/app/utils/withApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ const withApi = <P extends object>(WrappedComponent: React.ComponentType<P>) =>
this.api.clear();
}

// TODO(ts): Update this when API client is typed
private api: any;
private api: Client;

render() {
return <WrappedComponent api={this.api as any} {...this.props as P} />;
return <WrappedComponent api={this.api} {...this.props as P} />;
}
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import styled from 'react-emotion';

import {Client} from 'app/api';
import {Config, EventsStatsData, Organization, Project} from 'app/types';
import {PanelAlert} from 'app/components/panels';
import {addErrorMessage} from 'app/actionCreators/indicator';
Expand All @@ -27,7 +28,7 @@ import {IncidentRule} from './types';
import IncidentRulesChart from './chart';

type Props = {
api: any;
api: Client;
config: Config;
data: EventsStatsData;
organization: Organization;
Expand Down Expand Up @@ -404,7 +405,7 @@ class RuleForm extends React.Component<Props, State> {
}

type RuleFormContainerProps = {
api: any;
api: Client;
config: Config;
organization: Organization;
project: Project;
Expand Down