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

fix(issues): Cleanup expect-errors in issue details components #86361

Merged
merged 1 commit into from
Mar 5, 2025
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
3 changes: 1 addition & 2 deletions static/app/views/issueDetails/groupDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,7 @@ const trackTabChanged = ({
const analyticsData = event
? event.tags
.filter(({key}) => ['device', 'os', 'browser'].includes(key))
.reduce((acc, {key, value}) => {
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
.reduce<Record<string, string>>((acc, {key, value}) => {
acc[key] = value;
return acc;
}, {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ class Item extends Component<Props, State> {
}

Object.keys(stateForId).forEach(key => {
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
if (stateForId[key] === this.state[key]) {
if (stateForId[key] === this.state[key as keyof State]) {
return;
}
this.setState(prevState => ({
Expand All @@ -111,9 +110,8 @@ class Item extends Component<Props, State> {
const {aggregate, scoresByInterface, issue, hasSimilarityEmbeddingsFeature} =
this.props;
const {visible, busy} = this.state;
const similarInterfaces = hasSimilarityEmbeddingsFeature
? ['exception']
: ['exception', 'message'];
const similarInterfaces: Array<'exception' | 'message'> =
hasSimilarityEmbeddingsFeature ? ['exception'] : ['exception', 'message'];

if (!visible) {
return null;
Expand Down Expand Up @@ -152,9 +150,7 @@ class Item extends Component<Props, State> {
<Columns>
<StyledCount value={issue.count} />
{similarInterfaces.map(interfaceName => {
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const avgScore = aggregate?.[interfaceName];
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const scoreList = scoresByInterface?.[interfaceName] || [];

// Check for valid number (and not NaN)
Expand Down
6 changes: 2 additions & 4 deletions static/app/views/issueDetails/groupTags/groupTagsDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ export function GroupTagsDrawer({group}: {group: Group}) {

const tagValues = useMemo(
() =>
data.reduce((valueMap, tag) => {
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
data.reduce<Record<string, string>>((valueMap, tag) => {
valueMap[tag.key] = tag.topValues.map(tv => tv.value).join(' ');
return valueMap;
}, {}),
Expand All @@ -99,8 +98,7 @@ export function GroupTagsDrawer({group}: {group: Group}) {
tag =>
tag.key.includes(search) ||
tag.name.includes(search) ||
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
tagValues[tag.key].includes(search)
tagValues[tag.key]?.includes(search)
);
return searchedTags;
}, [data, search, tagValues, highlightTagKeys]);
Expand Down
3 changes: 1 addition & 2 deletions static/app/views/issueDetails/streamline/eventGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function EventGraph({group, event, ...styleProps}: EventGraphProps) {
});

const {data: uniqueUsersCount, isPending: isPendingUniqueUsersCount} = useApiQuery<{
data: Array<{count_unique: number}>;
data: Array<{'count_unique(user)': number}>;
}>(
[
`/organizations/${organization.slug}/events/`,
Expand All @@ -133,7 +133,6 @@ export function EventGraph({group, event, ...styleProps}: EventGraphProps) {
staleTime: 60_000,
}
);
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const userCount = uniqueUsersCount?.data[0]?.['count_unique(user)'] ?? 0;

const {series: eventSeries, count: eventCount} = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ export function IssueEventNavigation({event, group}: IssueEventNavigationProps)
onAction={key => {
trackAnalytics('issue_details.issue_content_selected', {
organization,
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
content: TabName[key],
content: TabName[key as keyof typeof TabName]!,
});
}}
items={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ export default function Resources({configResources, eventPlatform, group}: Props
const organization = useOrganization();
const links: ResourceLink[] = [
...configResources.links,
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
...(configResources.linksByPlatform[eventPlatform ?? ''] ?? []),
...(configResources.linksByPlatform[
(eventPlatform ?? '') as keyof typeof configResources.linksByPlatform
] ?? []),
];

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ export function useTraceTimelineEvents({event}: UseTraceTimelineEventsOptions):
culprit: event.culprit,
id: event.id,
'issue.id': Number(event.groupID),
message: event.message,
project: event.projectID,
// The project name for current event is not used
'project.name': '',
timestamp: event.dateCreated!,
title: event.title,
transaction: '',
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
'event.type': event['event.type'],
'event.type': event.type === 'default' ? 'default' : 'error',
'error.value': [event.message],
'stack.function': [],
});
}
const timestamps = events.map(e => new Date(e.timestamp).getTime());
Expand Down
3 changes: 1 addition & 2 deletions static/app/views/issueDetails/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ export function getSubscriptionReason(group: Group) {
}

if (reason && SUBSCRIPTION_REASONS.hasOwnProperty(reason)) {
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
return SUBSCRIPTION_REASONS[reason];
return SUBSCRIPTION_REASONS[reason as keyof typeof SUBSCRIPTION_REASONS];
}
}

Expand Down
Loading