-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(ui): Typescript 4 misc fixes #20703
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). |
@@ -358,7 +358,7 @@ const getIconMargin = ({size, hasChildren}: IconProps) => { | |||
return size && size.endsWith('small') ? '6px' : '8px'; | |||
}; | |||
|
|||
const Icon = styled('span')<IconProps>` | |||
const Icon = styled('span')<IconProps & Omit<StyledButtonProps, 'theme'>>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed all the types for getFontSize
and getIconMargin
size-limit report
|
@@ -15,7 +15,7 @@ export function hasNonContributingComponent(component: EventGroupComponent | und | |||
} | |||
|
|||
export function shouldInlineComponentValue(component: EventGroupComponent) { | |||
return component.values.every(value => !isObject(value)); | |||
return (component.values as EventGroupComponent[]).every(value => !isObject(value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasn't sure on this, but it didn't like calling .every
on type EventGroupComponent[] | string[]
possibly because EventGroupComponent
was self referencing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typescript playground of this weird one
src/sentry/static/sentry/app/components/events/interfaces/spans/spanDetail.tsx
Outdated
Show resolved
Hide resolved
@@ -307,6 +307,8 @@ export const setBodyUserSelect = (nextValues: UserSelectValues): UserSelectValue | |||
// MozUserSelect is not typed in TS | |||
// @ts-ignore | |||
MozUserSelect: document.body.style.MozUserSelect, | |||
// msUserSelect is not typed in TS | |||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msUserSelect is now also missing in ts 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why? Should we be dropping support too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://caniuse.com/user-select-none
Seems like we could
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this.
I'm aware of this being a missing type in TypeScript. This was causing an issue now because of updated type definitions for user select on v4.
src/sentry/static/sentry/app/components/selectMembers/index.tsx
Outdated
Show resolved
Hide resolved
@@ -918,7 +918,7 @@ class EventView { | |||
const environment = this.environment as string[]; | |||
|
|||
// generate event query | |||
const eventQuery: EventQuery & LocationQuery = Object.assign( | |||
const eventQuery = Object.assign( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This errors in ts4
i think this change is more correct, eventQuery isn't EventQuery & LocationQuery
, but instead we're casting the result from object.assign to EventQuery & LocationQuery
@@ -235,7 +235,7 @@ class QueryList extends React.Component<Props> { | |||
onCursor={(cursor: string, path: string, query: Query, direction: number) => { | |||
const offset = Number(cursor.split(':')[1]); | |||
|
|||
const newQuery = {...query, cursor}; | |||
const newQuery: Query & {cursor?: string} = {...query, cursor}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allow deletion via optional
src/sentry/static/sentry/app/views/settings/projectAlerts/issueEditor/index.tsx
Outdated
Show resolved
Hide resolved
@@ -127,7 +127,7 @@ class EventDetailsContent extends AsyncComponent<Props, State> { | |||
} | |||
const eventReference = {...event}; | |||
if (eventReference.id) { | |||
delete eventReference.id; | |||
delete (eventReference as any).id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about refactoring the spread to something like
{id:_, ...eventReference} = event
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eventReference is passed to functions that then expect Event type. Without the id it errors as well. Could change the type of Event but that also feels like a bigger change.
@@ -307,6 +307,8 @@ export const setBodyUserSelect = (nextValues: UserSelectValues): UserSelectValue | |||
// MozUserSelect is not typed in TS | |||
// @ts-ignore | |||
MozUserSelect: document.body.style.MozUserSelect, | |||
// msUserSelect is not typed in TS | |||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why? Should we be dropping support too?
src/sentry/static/sentry/app/components/events/interfaces/spans/spanDetail.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good to me.
# Conflicts: # src/sentry/static/sentry/app/data/forms/projectGeneralSettings.tsx
This is pretty much all of them except the HoF issues in #20701
The most common issue was with deleting a property that is not optional.