-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Changes from all commits
aca1bed
904f461
c1603fa
85a7cc5
03f1cb6
e8b6e11
aa4a8c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. wasn't sure on this, but it didn't like calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typescript playground of this weird one |
||
} | ||
|
||
export function groupingComponentFilter( | ||
|
Original file line number | Diff line number | Diff line 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 commentThe 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 commentThe 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 commentThe 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 commentThe 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. |
||
msUserSelect: document.body.style.msUserSelect, | ||
webkitUserSelect: document.body.style.webkitUserSelect, | ||
}; | ||
|
@@ -315,6 +317,8 @@ export const setBodyUserSelect = (nextValues: UserSelectValues): UserSelectValue | |
// MozUserSelect is not typed in TS | ||
// @ts-ignore | ||
document.body.style.MozUserSelect = nextValues.MozUserSelect || ''; | ||
// msUserSelect is not typed in TS | ||
// @ts-ignore | ||
document.body.style.msUserSelect = nextValues.msUserSelect || ''; | ||
document.body.style.webkitUserSelect = nextValues.webkitUserSelect || ''; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 |
||
omit(picked, DATETIME_QUERY_STRING_KEYS), | ||
normalizedTimeWindowParams, | ||
{ | ||
|
@@ -929,7 +929,7 @@ class EventView { | |
per_page: DEFAULT_PER_PAGE, | ||
query: this.query, | ||
} | ||
); | ||
) as EventQuery & LocationQuery; | ||
|
||
if (!eventQuery.sort) { | ||
delete eventQuery.sort; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. What about refactoring the spread to something like
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
} | ||
const tagKey = this.generateTagKey(tag); | ||
const nextView = getExpandedResults(eventView, {[tagKey]: tag.value}, eventReference); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. allow deletion via optional |
||
const isPrevious = direction === -1; | ||
|
||
if (offset <= 0 && isPrevious) { | ||
|
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
andgetIconMargin